Senin, 07 Desember 2020

How to delete from a table using JOIN in SQL Server

It's a little bit tricky to delete from a table while using any type of JOIN in SQL like Inner Join, Left Outer Join, or Right Outer Join. The obvious syntax doesn't work as shown below:
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 that I want to delete from the Deals tables, but only for Sony.

Lorem ipsum is simply dummy text of the printing and typesetting industry.

Comments


EmoticonEmoticon