Daily Archives: April 24, 2012

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 !

Follow

Get every new post delivered to your Inbox.