Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Create Procedure [dbo].[prc_PLC_getDealContactPerson]
@DealID bigint
As
Begin

select * from PLC_ClientContactPerson where PLC_ClientContactPersonID (select PLC_ClientCotnactPersonId from PLC_DealCOntact where PLC_DealID=@DealID);
END

What I have tried:

i'm trying to run this procedure but its giving me error.i'm new to sql please correct error
Posted
Updated 19-Jul-16 20:53pm

1 solution

You are missing the IN clause.

select * from PLC_ClientContactPerson where PLC_ClientContactPersonID IN (select PLC_ClientCotnactPersonId from PLC_DealCOntact where PLC_DealID=@DealID);

You can also use

select * from PLC_ClientContactPerson a,
(select PLC_ClientCotnactPersonId from PLC_DealCOntact where PLC_DealID=@DealID) b
where a.PLC_ClientContactPersonID = b.PLC_ClientContactPersonID
 
Share this answer
 
v2
Comments
Member 10549697 20-Jul-16 6:14am    
Thank You Sir. IN keyword was missing

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900