SQL swap field values
- by Silence
I have a SQL table (MYSQL 4.0 to be precise) composed of the following :
int no (primary)
int field1
int field2
I would like to swap the values of field1 with the values of field2 and vice-versa.
Ex.: 1;2.5;3.76 becomes 1;3.76;2.5
I need a swapping temporary variable of some sort. But I don't think I can use something like
Set @var1 = field1
inside my update statement. And I don't think altering the table to add a temporary column is my best best either.