I have created 2 tables: Table1 and Table2
Table1 has 1 column ‘t1Name’ and Table2 has ‘t2Name’
I want to insert a new record in Table1, if the value of t2Name does not match with any value of t1Name in any record in Table1.
INSERT INTO Table1(t1Name)
SELECT t2Name
FROM Table2
WHERE NOT EXIST(SELECT 1 FROM Table1 WHERE t1Name = Table2.t2Name)
But it is always complaining “the multi-part identifier ‘Table2.t2Name’ could not be bound”.
Can someone explain the reason to me and how to solve it?
New contributor
TiggerWolfie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.