Reputation: 63
Table1 contains ColumnA, Table2 contains ColumnA and ColumnB.
How do I remove(delete) rows in Table2 that contain ColumnA values in both tables?
Upvotes: 1
Views: 46
Reputation: 17943
Another approach using EXISTS
delete t
from table2 t
where exists
(
select 1 from table1 t1 where t1.columna=t.columna
)
Upvotes: 2
Reputation: 44796
Delete rows from table2 where the ColumnA value is also found in table1:
delete from table2
where ColumnA in (select ColumnA from table1)
Upvotes: 2