here's my code:
SELECT
PS_UWO_HEAV_DEG_VW."EMPLID",
PS_UWO_HE_APLNT_VW."ACAD_PLAN", PS_UWO_HE_APLNT_VW."EFFDT", PS_UWO_HE_APLNT_VW."DESCR",
PS_UWO_HEAV_DEG_VW."AV_CLASS_YR",
PS_UWO_HE_A_GRP_VW."EFFDT", PS_UWO_HE_A_GRP_VW."DESCR"
FROM
"SYSADM"."PS_UWO_HEAV_DEG_VW" PS_UWO_HEAV_DEG_VW,
"SYSADM"."PS_UWO_HE_APLNT_VW" PS_UWO_HE_APLNT_VW,
"SYSADM"."PS_UWO_HE_A_GRP_VW" PS_UWO_HE_A_GRP_VW
WHERE
PS_UWO_HEAV_DEG_VW."ACAD_PLAN" = PS_UWO_HE_APLNT_VW."ACAD_PLAN" AND
PS_UWO_HEAV_DEG_VW."ACAD_ORG" = PS_UWO_HE_A_GRP_VW."ACAD_GROUP" AND
(PS_UWO_HEAV_DEG_VW."EMPLID" = '300012881' OR
PS_UWO_HEAV_DEG_VW."EMPLID" = '000313286' OR
PS_UWO_HEAV_DEG_VW."EMPLID" = '000005178') AND
PS_UWO_HE_APLNT_VW."EFFDT" =
(SELECT MAX(PS_UWO_HE_APLNT_VW."EFFDT" FROM PS_UWO_HE_APLNT_VW
WHERE PS_UWO_HEAV_DEG_VW."ACAD_PLAN" = PS_UWO_HE_APLNT_VW."ACAD_PLAN" and
TO_NUMBER(TO_CHAR(PS_UWO_HE_APLNT_VW."EFFDT",'yyyy'))<=PS_UWO_HEAV_DEG_VW."AV_CLASS_YR" AND
PS_UWO_HE_A_GRP_VW."EFFDT" =
(SELECT MAX(PS_UWO_HE_A_GRP_VW2."EFFDT" FROM "SYSADM"."PS_UWO_HE_A_GRP_VW" PS_UWO_HE_A_GRP_VW2
WHERE PS_UWO_HEAV_DEG_VW."ACAD_ORG" = PS_UWO_HE_A_GRP_VW2."ACAD_GROUP" and
TO_NUMBER(TO_CHAR(PS_UWO_HE_A_GRP_VW2."EFFDT",'yyyy'))<=PS_UWO_HEAV_DEG_VW."AV_CLASS_YR"
ORDER BY
PS_UWO_HEAV_DEG_VW."EMPLID" ASC
the problem is I came across one id that will have something in the acad_plan table BUT NOT a corresponding record in the plant table. I still want that record to come through in the rare case that there won't be a matching record in the plant table.
SELECT
PS_UWO_HEAV_DEG_VW."EMPLID",
PS_UWO_HE_APLNT_VW."ACAD_PLAN", PS_UWO_HE_APLNT_VW."EFFDT", PS_UWO_HE_APLNT_VW."DESCR",
PS_UWO_HEAV_DEG_VW."AV_CLASS_YR",
PS_UWO_HE_A_GRP_VW."EFFDT", PS_UWO_HE_A_GRP_VW."DESCR"
FROM
"SYSADM"."PS_UWO_HEAV_DEG_VW" PS_UWO_HEAV_DEG_VW,
"SYSADM"."PS_UWO_HE_APLNT_VW" PS_UWO_HE_APLNT_VW,
"SYSADM"."PS_UWO_HE_A_GRP_VW" PS_UWO_HE_A_GRP_VW
WHERE
PS_UWO_HEAV_DEG_VW."ACAD_PLAN" = PS_UWO_HE_APLNT_VW."ACAD_PLAN" AND
PS_UWO_HEAV_DEG_VW."ACAD_ORG" = PS_UWO_HE_A_GRP_VW."ACAD_GROUP" AND
(PS_UWO_HEAV_DEG_VW."EMPLID" = '300012881' OR
PS_UWO_HEAV_DEG_VW."EMPLID" = '000313286' OR
PS_UWO_HEAV_DEG_VW."EMPLID" = '000005178') AND
PS_UWO_HE_APLNT_VW."EFFDT" =
(SELECT MAX(PS_UWO_HE_APLNT_VW."EFFDT" FROM PS_UWO_HE_APLNT_VW
WHERE PS_UWO_HEAV_DEG_VW."ACAD_PLAN" = PS_UWO_HE_APLNT_VW."ACAD_PLAN" and
TO_NUMBER(TO_CHAR(PS_UWO_HE_APLNT_VW."EFFDT",'yyyy'))<=PS_UWO_HEAV_DEG_VW."AV_CLASS_YR" AND
PS_UWO_HE_A_GRP_VW."EFFDT" =
(SELECT MAX(PS_UWO_HE_A_GRP_VW2."EFFDT" FROM "SYSADM"."PS_UWO_HE_A_GRP_VW" PS_UWO_HE_A_GRP_VW2
WHERE PS_UWO_HEAV_DEG_VW."ACAD_ORG" = PS_UWO_HE_A_GRP_VW2."ACAD_GROUP" and
TO_NUMBER(TO_CHAR(PS_UWO_HE_A_GRP_VW2."EFFDT",'yyyy'))<=PS_UWO_HEAV_DEG_VW."AV_CLASS_YR"
ORDER BY
PS_UWO_HEAV_DEG_VW."EMPLID" ASC
the problem is I came across one id that will have something in the acad_plan table BUT NOT a corresponding record in the plant table. I still want that record to come through in the rare case that there won't be a matching record in the plant table.