If you want to swap values of 2 columns (e.g. col1 and col2) in a table (e.g. a_table), you can use below SQL:
UPDATE a_table SET col1=(@temp:=col1), col1 = col2, col2 = @temp;
Do you have another ways? Pls post comment here. Thanks!
Showing posts with label swap 2 columns. Show all posts
Showing posts with label swap 2 columns. Show all posts
Thursday, August 7, 2014
Subscribe to:
Posts (Atom)