Friday, May 30, 2008

[sql] Delete rows with join to another table in SQL Server

The non-obvious part is that you have to put the table name twice -- after the "delete" AND after the "from".



delete [TargetTable]
from [TargetTable]
join [JoinTable] on [TargetTable].[Column] = [JoinTable].[Column]