> -----Original Message-----
> From: Jörgen Winqvist [mailto:jorgen@;winqvist.net]
>
> I need to let the values in two columns change place with each other. 
> I've tried to "update xxx set a=b, b=a" but that doesn't work 
> (b=a uses 
> the "new" a).

Here's a cute trick for swapping two numbers without using a temporary variable:

  set a=a-b, b=b+a, a=b-a

I don't know how applicable it is to your query, but it might be worth considering.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to