Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 DELETE on Inner joins

Author  Topic 

scmay
Starting Member

22 Posts

Posted - 2007-06-17 : 23:13:53
DELETE FROM ObPostEvent WHERE EpisodeID IN (SELECT ID FROM ObMotherEpisode WHERE ID = @Urno)

DELETE FROM ObPostEvent INNER JOIN ObMotherEpisode ON ObMotherEpisode.ID = ObPostEvent.EpisodeID WHERE ObMotherEpisode.ID = @Urno

Are the 2 statements give the same meaning? I get an error for the 2nd statement as follows :-

Server: Msg 156, Level 15, State 1, Procedure spArchiveObPostEvent, Line 78
Incorrect syntax near the keyword 'INNER'.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-17 : 23:18:24
2nd statment should be
DELETE P
FROM ObPostEvent P INNER JOIN ObMotherEpisode M
ON P.ID = M.EpisodeID
WHERE M.ID = @Urno




KH

Go to Top of Page
   

- Advertisement -