简体   繁体   中英

More than one INSERT STATEMENTS

I have a database with 3 tables. All tables have the same structure. I want to copy the records from the one table to the other 2 by using one query. Is that possible?

Thank you in advance!

Yeah that's not very hard:

INSERT INTO table1 (column1, colum2)
SELECT column1, column2 FROM table2;

You do in fact need 2 queries though, since you can only insert into 1 table with an insert statement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM