Is there a query with which i can exchange the values of two rows with single query?
相关问题
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
- mySQL alter table on update, current timestamp
you can see the solution in this article
http://www.microshell.com/database/sql/swap-values-in-2-rows-sql/
look at the : The elegant way , make a join to get the data from the 2 rows to be swapped in 1 row, after that make an update is easy.
example :