It's a little bit tricky to delete from a table while using any type of JOIN in SQL e.g. Inner Join, Left Outer Join, or Right Outer Join. The obvious syntax doesn't work as shown below:
here I have a table with a list of expired deals which I want to delete from the Deals tables, but only for Sony.
When I run this SQL Query in Microsoft SQL Server 2008, it gave me following error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'e'.
Now, I am puzzled, how to delete from a table while using INNER JOIN in SQL Server?
Read more »
delete from #Expired e INNER JOIN
Deals d ON e.DealId = d.DealId
Where d.Brand = 'Sony'
here I have a table with a list of expired deals which I want to delete from the Deals tables, but only for Sony.
When I run this SQL Query in Microsoft SQL Server 2008, it gave me following error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'e'.
Now, I am puzzled, how to delete from a table while using INNER JOIN in SQL Server?
No comments:
Post a Comment