deleting a record with join condition

DELETE dbo.Candy  
  FROM dbo.Candy INNER JOIN dbo.CandyReport  
    ON Candy.CandyReportId = CandyReport.CandyReportId  
 WHERE CandyReport.CandyId = @CandyId
 
DELETE dbo.CandyReport
 WHERE CandyReport.CandyId = @CandyId

사실 그렇게 어려운 건 아니지만, 그래도 tip으로.

deleting a record with join condition

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s