SQL Server: Delete a record with condition on multiple columns of another table
If you want to delete a record from a table where the relation with another table is on multiple columns or you want to check it for some conditions on multiple columns of another table then with a simple join your job can be done.
Example:
DELETE Table1 FROM Table1 INNER JOIN Table2 ON Table1.Column1=Table2.Column1 AND Table1.Column2=Table2.Column2
Drop a comment in case you have any question or suggestion.
Thanks !
Posted on April 24, 2012, in SQL Server and tagged SQL Server. Bookmark the permalink. 3 Comments.

Mistake corrected.
Thank you! I had to convert PostgreSQL syntax into MSSQL syntax.
The PostgreSQL syntax was:
DELETE FROM Table1 USING Table2, Table3 WHERE Table1.id = Table2.id AND Table2.id = Table3.id AND Table3.id = @id
Which using your solution I was able to convert to MSSQL syntax:
DELETE Table1 FROM Table1
INNER JOIN Table2 ON Table1.id = Table2.id
INNER JOIN Table3 ON Table2.id = Table3.id
WHERE Table3.id=@id
I am really happy to know that the post was useful to you. Thanks for spending your valuable time to write a feedback. Again I too learned a new thing about PostgreSQL from you.