472,353 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

sql trees move some element

hi

I have a table:
id | integer | not null default
nextval('public.menu_2_id_seq'::text)
parent_id | integer |
description | text | not null

how am I able to move some element with id = x before or after
element with id = y ?

--
WBR, sector119

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #1
1 1496
> I have a table:
id | integer | not null default
nextval('public.menu_2_id_seq'::text)
parent_id | integer |
description | text | not null

how am I able to move some element with id = x before or after
element with id = y ?

In relational databases there is no such concept of "before"
and "after". If you want to make id.x smaller then id.y you
can just update the column id to the values you desire. You
then need to make sure that you don't get in the way of the id
value of other rows. One way to do it would be to compare the
values of id.x and id.y and switch them around if necessary.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lothar Scholz | last post by:
I think i have overseen the API functions to copy and move files and complete file trees, because i can't find them in the standart library. Can...
1
by: Aleksi Kallio | last post by:
I'm passing a result tree fragment that holds multiple strings (fieldnames, in this case) and in the called template I wan't to test if a certain...
5
by: bugbear | last post by:
I need to process some XML files that are rather large. However their structure may usefully be expressed as <ELEMENT FILE (RECORD)+> .. .. .....
1
by: barnesc | last post by:
Hi again, Since my linear algebra library appears not to serve any practical need (I found cgkit, and that works better for me), I've gotten...
0
by: Sergei Levchenko | last post by:
hi I have a table: id | integer | not null default nextval('public.menu_2_id_seq'::text) parent_id | integer | description | text ...
7
by: jefftyzzer | last post by:
Friends: In a DB2 UDB LUW table, I have a table with pairs of equivalent ID's. What I want to do is assign all equivalent IDs to the same group...
9
by: william | last post by:
When implementing Linked list, stack, or trees, we always use pointers to 'link' the nodes. And every node is always defined as: struct node {...
7
by: Vinodh | last post by:
Started reading about Binary Trees and got the following questions in mind. Please help. Definition of a Binary Tree from "Data Structures using...
8
by: Bert | last post by:
How can my response to this problem be better? The pot doesn't work that well when you enter 25, 21, 17 and some others. The problem: ...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.