I have table A and table B, same schemas.
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.
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)
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.