I have 3 tables say table A, B, C. Their schema structure is different but they have a unique column ID. Using C# i want to
SELECT * FROM A
Then check if any of the records selected from A exists in B (ID being key). If it exists i insert the records in C. How can i go about this?
INSERT INTO C(ID, ...)
SELECT A.ID, ....
FROM A
INNER JOIN B ON A.ID = B.ID
You can do
insert into C(id, Name)
select id, name from A
inner join B on A.id = B.id
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.