Originally posted by Teddy
Could you post a small sample set and the result set you would like to see?
Here is the query that I have started. Just need to work on the CASE statement.
My goal is to just show employees whose EjLocation doesn't match the PrbCheckSeqNo listed in the THEN statement.
Name Location CheckCode
John Smith AGACES 8500
This person would show up because they don't equal 3410, 3415 or a code starting with 83##.
SELECT EpLastName, EpFirstName, EjLocation, PrbCheckSeqNo
FROM EJob, EBase, EPayrollBase
/* Check codes not matching facility code- excludes virtuals
Dev. T.Rucker 1/04 */
WHERE EpFlxideb = EjFlxideb AND Ebflxid = Prbflxideb AND PrbDateend is null AND EjDateEnd IS NULL AND Epflxideb = EeFlxideb AND
EeDateEnd IS NULL AND NOT PrbCheckSeqNo = '0000' AND
WHEN EjLocation ='AGACES'
WHEN EjLocation = 'BALCES'
END <> PrbCheckSeqNo
ORDER BY EjLocation, PrbCheckSeqNo