Bob Ramsey <[EMAIL PROTECTED]> wrote:
> 
> I'm using 3.23.51 and I'd like to update a field in a certain order.  I've 
> got a table of images for a slide show and the format of the table is:
> 
> image varchar(128) not null
> order_number integer not null primary key
> 
> So we might have something like:
> 
> duck.jpg 1
> cat.jpg 2
> horse.jpg 3
> 
> I want the user to be able to insert a new picture anywhere and 
> automatically up date the order numbers of the other items.  Apparently 
> this is easy in version 4, because you can just do:
> 
> update slideshow set order_number=order_number +1 where order_number >1 
> order by order_number desc
> 
> Because you have to change 3->4, 2->3 so that you can insert a new number 2.
> 
> Is there a good workaround for this in version 3?

Select ordered data to the temporary table and then increase order_number. You can 
also drop primary key, update order_number and add primary key. 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to