Posted By

Piotrek290 on 05/06/10


Tagged


Versions (?)

MySql change order


 / Published in: MySQL
 

URL: http://www.forumweb.pl/viewtopic.php?p=290942#290942

  1. UPDATE tabela
  2. SET ORDER = IF (ORDER = $old_order, $new_order, ORDER + SIGN($old_order - $new_order))
  3. WHERE ORDER >= LEAST($new_order, $old_order) AND ORDER <= GREATEST($new_order, $old_order)

Report this snippet  

You need to login to post a comment.