Page 1 of 1

change order of many query's with 1 query?

Posted: Wed Dec 27, 2006 10:26 pm
by potato
hi,

i need some oppinion on a problem ive got.
I want to change the ordernr of different mysql records with one query if its possible.
for example: i've got a mysql table with following attributes: id, name, order
in this table are some records:

485, tom, 1
486, bart, 2
487, david, 3
488, pieter, 4

now i want to add a new record, but it has to have order 2, so it comes between tom and bart

like this:

485, tom, 1
486, bart, 3
487, david, 4
488, pieter, 5
489, newrecord, 2

somebody knwos how this can be done the most easy way?

many thanks to you guys!

Posted: Wed Dec 27, 2006 11:29 pm
by daedalus__

Posted: Wed Dec 27, 2006 11:46 pm
by feyd
viewtopic.php?t=60966 may be of interest.

Posted: Thu Dec 28, 2006 12:21 am
by potato
thanx feyd! Just what i was looking for. :wink: