I have the following tables and columns:
Table1 with 3 columns: a, b, c
Table2 with 1 column: a
I want to delete the rows from Table1 whenever there is a match of Table1.a = Table2.a.
I tried the following sql but it tries to delete all the rows in Table1 instead of only when there is a match of Table1.a = Table2.a:
delete from table1 where exists (select * from table2 inner join table1 on table2.a=table1.a);
What am I doing wrong?
Please help - thanks!
Table1 with 3 columns: a, b, c
Table2 with 1 column: a
I want to delete the rows from Table1 whenever there is a match of Table1.a = Table2.a.
I tried the following sql but it tries to delete all the rows in Table1 instead of only when there is a match of Table1.a = Table2.a:
delete from table1 where exists (select * from table2 inner join table1 on table2.a=table1.a);
What am I doing wrong?
Please help - thanks!