|
help
I am coding sql in a perl. I am trying to use dateadd. the code below is not working. It errors when the code starts the DATEADD
where B.EMPLID = A.EMPLID
and C.EMPLID = A.EMPLID
and G.EMPLID = A.EMPLID
and A.EFFDT =
(select max(A_ED.EFFDT) from PS_JOB A_ED
where A.EMPLID = A_ED.EMPLID
and A.EMPL_RCD = A_ED.EMPL_RCD
and A_ED.EFFDT <= substring(convert(char, getdate(), 121), 1, 10))
and A.EFFSEQ =
(select max(A_ES.EFFSEQ) from PS_JOB A_ES
where A.EMPLID = A_ES.EMPLID
and A.EMPL_RCD = A_ES.EMPL_RCD
and A.EFFDT = A_ES.EFFDT)
and substring(A.JOBCODE, 1, 2) <> 'CL'
and A.BUSINESS_UNIT like '$agency'
and (dateadd(DAY, -1, A.EFFDT))
and A.EFFDT between '$fromdate' and '$todate'
--
|