October 15, 2013 at 1:04 pm
Hi,
Been a long time since I had to do any SSRS. I have this query and I need to use two different fields for my between @Startdate and @Enddate.
Here's the query:
SELECT
PH.PehOrgLvl1 as Branch
, PH.PehOrgLvl2 as Dept
, LTRIM(RTRIM(PR.PRGNAMELAST + '')) + ', ' + LTRIM(RTRIM(PR.PRGNAMEFIRST + '')) as DESCRIPTION
, PH.PEHCURAMT as TRANSACTIONAMT
, PH.PEHCURHRS as HOURS
, PH.PehHourlyPayRate as Rate
, PR.PRGPAYDATE as APPLYDATE
, PH.PEHCHARGEDATE as ENTRYDATE
FROM GSHQSQL4.ULTIPRO_WSI.DBO.PEARHIST PH, GSHQSQL4.ULTIPRO_WSI.DBO.PAYREG PR, GSHQSQL4.ULTIPRO_WSI.DBO.GLDEFRLS GL
WHERE PH.PEHGENNUMBER = PR.PRGGENNUMBER AND PH.PEHEARNCODE = GL.GLRCOMPONENTCODE
AND PH.PEHORGLVL2 = 'WSIAMS' --change this to user select
AND PH.PehOrgLvl1 = 'WSI112' --change this to user select
AND (GL.GLRBASEACCT = '5200' OR GL.GLRBASEACCT = '5204')
AND PH.PEHORGLVL1 NOT IN ('WSI180','WSI184', 'WSIW01')
AND PH.PEHCHARGEDATE BETWEEN @StartDate and @EndDate
So, instead of
PH.PEHCHARGEDATE BETWEEN @Startdate and @Enddate
I really need something like:
PH.PEHCHARGEDATE BETWEEN @Startdate and PR.PRGPAYDATE @Enddate
The above syntax is incorrect.
So I need to be able to get the dates between the above two fields. So my Startdate = PH.PEHCHARGEDATE and my Enddate = PR.PRGPAYDATE
October 15, 2013 at 1:37 pm
got it
PH.PEHCHARGEDATE >= @Startdate and PR.PRGPAYDATE <= @Enddate
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply