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