[英]Insert a part of a table into another table
I have table A and table B, same schemas. 我有表A和表B,具有相同的架构。
I want to insert certain rows from table A into table B. For example, insert into table B all rows from table A with column 'abc' > 10. 我想将表A中的某些行插入表B中。例如,将表A中的所有行插入列'abc'> 10。
Couldn't figure out how to do it 无法弄清楚怎么做
Something like this 像这样的东西
INSERT INTO B (supplier_id, supplier_name)
SELECT supplier_id, supplier_name FROM A
WHERE abc > 10;
Make sense? 说得通?
You can use the following notation: 您可以使用以下表示法:
BEGIN TRAN
INSERT INTO ExistingTable (Col1, Col2...)
SELECT Something1, Something2... FROM Table1 WHERE ...
--ROLLBACK/COMMIT
At first blush, I'd say something like: 乍一看,我会说:
Insert Into B
(Select * from A
Where abc > 10)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.