Help: I have a field a B in table A, and now some of the data is reversed. How to change it.
Help: I have a field a B in table A, and now some of the data is reversed. How to change it.
That is, the data stored in B is updated to a. (This will write the next one I will write), but also ask a master to point out.
------Solution--------------------
SQL Code
Set @tmp = ""; Update table set field_a= (@tmp: =field_a), field_a=field_b,[email protected] where ...
------Solution--------------------
It is recommended to use SQLyog to directly execute multiple statements. http://download.csdn.net/detail/dmtnewtons/4230136
SQL Code
Update A set a.a= "New_data_a", a.b= "New_data_b" where a.a= "old_data_a" and a.b= "Old_data_b";
------Solution--------------------
Change the name of the field
------Solution--------------------
Great!
Explore
SQL Code
Set @tmp = "";
Update table Set field_a= (@tmp: =field_a), field_a=field_b,[email protected] where ...