Can you try the below code?
DECLARE @no varchar(2)='23'
select getdate()
where CAST(@no as int)=23
SELECT GGI.IID ID
, G.GrantNum
, PA.ProgramArea
, G.GranteeName
, G.Project
, L2.Description Race
FROM TGrant G
INNER JOIN TGrant_GranteeInfo GGI ON G.IID=GGI.GrantIID
left join TProgramArea PA on G.ProgramAreaIID=PA.IID
right join TLookup L2 on L2.Code=GGI.TargetRace_Codes and L2.FieldName='TargetRace'
WHERE G.GrantType='CSAT'
AND cast(GGI.TargetRace_Codes as int)IN (1,2,3,4,5,6,7)
ORDER BY PA.ProgramArea
--Prashanth
No comments:
Post a Comment