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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 help with query / delete with join

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2009-09-03 : 06:41:36
Hey Guys,

trying to run the below query but get an error.. is there anyway I can do a DELETE based on a JOIN ?

Thanks!
Mike123

CREATE PROCEDURE [dbo].[delete_assignment_item_designer]
(
@designerID int,
@itemCode varchar(6)
)
AS SET NOCOUNT ON

DELETE FROM [dbo].[tblItemAssignments] IA

JOIN tblOrderedItems OI on OI.itemID = IA.itemID

WHERE designerID = @designerID AND OI.itemCode = @itemCode

GO



YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-09-03 : 06:48:18
DELETE FROM [dbo].[tblItemAssignments]
FROM [dbo].[tblItemAssignments] IA
JOIN tblOrderedItems OI on OI.itemID = IA.itemID
WHERE designerID = @designerID AND OI.itemCode = @itemCode
Go to Top of Page
   

- Advertisement -