HRISCONSULTANT
Technical User
A user is getting expected results with the following...
(SELECT MAX(A.EFFDT) FROM PS_JOB A WHERE A.EMPLID = JOB.EMPLID
AND A.EFFDT < JOB.EFFDT)
Job is the first ps_job
Job1 is the second ps_job
There is a problem however when there is a new hire or conversion (no records returned). I've suggested using a CASE STATEMENT for when the count was greater than on or just one but the user is getting the following...
I tried your CASE statement within the select and also as a stand-alone SQL criteria. In both tests, I get a "group function not allowed here" error message. I also tried appending the SQL to the existing condition and got "missing right parentheses".
The statement I provided him is...
CASE JOB1.EFFDT WHEN COUNT(*)>1 THEN (SELECT MAX (A.EFFDT) FROM PS_JOB A
WHERE A.EMPLID=JOB.EMPLID AND A.EFFDT<JOB.EFFDT) ELSE (SELECT A.EFFDT FROM
PS_JOB WHERE A.EMPLID=JOB.EMPLID AND A.EFFDT=JOB.EFFDT) END
Mind you my programming is a bit rusty - any suggestion greatly appreaciated...
(SELECT MAX(A.EFFDT) FROM PS_JOB A WHERE A.EMPLID = JOB.EMPLID
AND A.EFFDT < JOB.EFFDT)
Job is the first ps_job
Job1 is the second ps_job
There is a problem however when there is a new hire or conversion (no records returned). I've suggested using a CASE STATEMENT for when the count was greater than on or just one but the user is getting the following...
I tried your CASE statement within the select and also as a stand-alone SQL criteria. In both tests, I get a "group function not allowed here" error message. I also tried appending the SQL to the existing condition and got "missing right parentheses".
The statement I provided him is...
CASE JOB1.EFFDT WHEN COUNT(*)>1 THEN (SELECT MAX (A.EFFDT) FROM PS_JOB A
WHERE A.EMPLID=JOB.EMPLID AND A.EFFDT<JOB.EFFDT) ELSE (SELECT A.EFFDT FROM
PS_JOB WHERE A.EMPLID=JOB.EMPLID AND A.EFFDT=JOB.EFFDT) END
Mind you my programming is a bit rusty - any suggestion greatly appreaciated...