Younger brother, I have A field AB in Table A, and some of the data is now reversed. How to change-php Tutorial

Source: Internet
Author: User
My table A contains the field AB, and some of the data is reversed. How to change it for help: I have A field AB in Table A, and now some data is reversed. How can we replace the data in B to be updated to. (I will write the next one. ------ Solution ------------------ SQLcodeset @ tmp & quot; up for help: I have A local field a B in Table A, and now some data is reversed. How to Change
My table A contains the local field a B. Now some data is reversed. How to Change
That is, data in B is stored in update to. (I will write the next one.

------ Solution --------------------
SQL code
Set @ tmp = ""; update table set field_a = (@ tmp: = field_a), field_a = field_ B, field_ B = @ tmp where ......
------ Solution --------------------
We recommend that you 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 --------------------
Changed the field name.
------ Solution --------------------
Great!

Discussion

SQL code

Set @ tmp = "";
Update table set field_a = (@ tmp: = field_a), field_a = field_ B, field_ B = @ tmp where ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.