Skip to content
Advertisement

Delete rows from table using JOIN – SQL Server

I have a table_A –

I have a table_B –

I want to remove rows from table B that have is_active value as 0 OR null in table A. So I’m thinking about an INNER JOIN on id column and applying a WHERE clause.

I don’t want any additional columns or changes in table B after the above query. Is this the right way to do it?

Advertisement

Answer

Instead of JOIN, use exists:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement