Mysql replication record implementation code

Source: Internet
Author: User

SQL
Copy codeThe Code is as follows:
Insert into 'table' ('id', 'AA', 'bb ', 'cc') SELECT 'id', 'A', 'bb ', 'cc' FROM 'table' (WHERE .....)

Tips:
Copy codeThe Code is as follows:
/**
* When copying a new record, you may need to update the id or part of the data (assuming that the id is automatically increased)
*
* Text_aa is a fixed value. You can assign a variable value in a script call, for example, $ aa)
* Note the difference between 'text _ AA' and 'cc'. One is data and the other is field.
**/
Insert into 'table' ('id', 'AA', 'bb ', 'cc') select', 'aa content', 'bb pay attention to cc symbol Difference ', 'cc' FROM 'table' (WHERE .....)

/**
* CONCAT ('bb', 'additional information-copy ')
* Add additional information on the basis of extracting the original data (which is understandable when I have seen xxx. xxx in windwos)
**/
Insert into 'table' ('id', 'A', 'bb ', 'cc') select', 'aa content', CONCAT ('bb ', 'additional information-copy'), 'cc' FROM 'table' (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.