re ordering auto increment

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

re ordering auto increment

Post by kendall »

Hey,

I have a table that has an auto_incremented column (not primary) which acts as a sort value for the information.

I want to know if i can "RE ORDER" the values of the column based on an update

e.g.
if row 4 is 3 and row 7 is 7 and i update row 7's sort vaule to 3 it should re order the row values from row for go down
can this be accomplished

Kendall
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

I'm not positive, but I think this is impossible.

Try running a query similar to the following one:

Code: Select all

UPDATE thetable SET thecolumn = 3 WHERE thecolumn = 7
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

I use something similar but its easier to handle as a non autoincrement value...i control it from the application
Post Reply