> Uhm, please ignore this email, it looks like this can't be done using > transactions > > begin transaction; > update book set "order"=2 where id=1; > update book set "order"=1 where id=2; > commit;
for atomic swapping, however, it can be done in a single obscure SQL statement: update book set order = 3 - order where id=1 or id=2 Which follows the pattern UPDATE tbl SET field = ( SELECT SUM(field) FROM tbl WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED] ) - field WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED] Any help? -tkc (aka "the atomic swapper"? :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---