Ask for a question about mysql basics. (in PHP) copy a record with id a to the same table and generate a new record. in this process, modify the values of some fields.

Source: Internet
Author: User
Ask for a basic mysql question. (in PHP) copy a record with id a to the same table and generate a new record. in this process, modify the values of some fields. how can this problem be written? This is the case: when a user copies a published item and then releases it, only the content that may be modified is submitted, other content is directly obtained from the database based on the copied record id. ask SQL for a basic mysql problem. (in PHP) copy a record with id a to the same table and generate a new record. in this process, modify the values of some fields. how can this problem be written?
The situation is as follows:
Copy a published item and modify a part of it before publishing it.

Only submitted content that may be modified during Publishing. other content is directly obtained from the database based on the copied record id.

How should I write SQL statements online? I don't know how to search for this problem... mysql php query and copy
------ Solution --------------------
The format is as follows:
Insert into user_list (username, 'password', 'status') SELECT 'asfasfasf', 'password', 'status' FROM user_list WHERE id = 2


The red part is username. if you do not want username with id = 2, change it to asfasfasf.
------ Solution --------------------
Reference:
The format is as follows:
Insert into user_list (username, 'password', 'status') SELECT 'asfasfasf', 'password', 'status' FROM user_list WHERE id = 2


The red part is username. if you do not want username with id = 2, change it to asfasfasf.
......

++
Change the content you want to modify in the SQL statement to what you need.
------ Solution --------------------
Use SQL statements
Insert into table (field) select field from table condition

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.