Okay, below is the sql statement that I have in the selections portion of reportsmith. I am trying to display an employees current benefit program and their previous benefit program (if they have one). What's happening is I'm getting multiple rows for some people, not everyone. I know it's probably a simple fix but I've played around with the code and I haven't been able to make it work. HELP!
("PV_BEN_PROG_VW2"."EFFSEQ"= (
SELECT MAX("INNERALIAS"."EFFSEQ")
FROM "SYSADM"."PV_BEN_PROG_VW" INNERALIAS
WHERE "INNERALIAS"."EMPLID" = "PV_BEN_PROG_VW2"."EMPLID"
AND "INNERALIAS"."EFFDT" < "PV_BEN_PROG_VW2"."EFFDT")
AND
"PV_BEN_PROG_VW2"."EFFDT" < (
SELECT MAX("INNERALIAS"."EFFDT")
FROM "SYSADM"."PV_BEN_PROG_VW" INNERALIAS
WHERE "INNERALIAS"."EMPLID" = "PV_BEN_PROG_VW2"."EMPLID"))
TIA,
Sarah
("PV_BEN_PROG_VW2"."EFFSEQ"= (
SELECT MAX("INNERALIAS"."EFFSEQ")
FROM "SYSADM"."PV_BEN_PROG_VW" INNERALIAS
WHERE "INNERALIAS"."EMPLID" = "PV_BEN_PROG_VW2"."EMPLID"
AND "INNERALIAS"."EFFDT" < "PV_BEN_PROG_VW2"."EFFDT")
AND
"PV_BEN_PROG_VW2"."EFFDT" < (
SELECT MAX("INNERALIAS"."EFFDT")
FROM "SYSADM"."PV_BEN_PROG_VW" INNERALIAS
WHERE "INNERALIAS"."EMPLID" = "PV_BEN_PROG_VW2"."EMPLID"))
TIA,
Sarah