change order of many query's with 1 query?
Posted: Wed Dec 27, 2006 10:26 pm
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!
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!