SELECT DM.LM_CI_ID , DM.LM_ROW_MAINT_DTTM FROM PS_LM_DMTHD_TBL DM WHERE %CurrentDateIn BETWEEN DM.EFFDT AND DM.LM_END_EFFDT AND NOT EXISTS ( SELECT 1 FROM PS_LM_ACT X WHERE X.LM_CI_ID = DM.LM_CI_ID) UNION SELECT CI.LM_CI_ID , CI.LM_ROW_MAINT_DTTM FROM PS_LM_CI_TBL CI WHERE %CurrentDateIn BETWEEN CI.EFFDT AND CI.LM_END_EFFDT AND NOT EXISTS ( SELECT 1 FROM PS_LM_ACT X WHERE X.LM_CI_ID = CI.LM_CI_ID) UNION SELECT DM.LM_CI_ID , DT.LM_ROW_MAINT_DTTM FROM PS_LM_DMTHD_TBL DM , PS_LM_DMTH_TYP_TBL DT WHERE %CurrentDateIn BETWEEN DM.EFFDT AND DM.LM_END_EFFDT AND DM.LM_DMTHD_TYPE_ID = DT.LM_DMTHD_TYPE_ID AND NOT EXISTS ( SELECT 1 FROM PS_LM_ACT X WHERE X.LM_CI_ID = DM.LM_CI_ID) UNION SELECT CTB.LM_CI_ID , CTB.LM_ROW_MAINT_DTTM FROM PS_LM_CI_TBL CTB WHERE %Sql(LM_ELIG_NOT_APPL_SQL,CTB) UNION SELECT ACT.LM_CI_ID , ACT.LM_ROW_MAINT_DTTM FROM PS_LM_ACT ACT WHERE LM_ACT_STATUS <> '1'
|