select distinct
a.comm_category,
b.comm_context,
b.descr,
b.descrshort
from PS_COMM_CA_CTX_TBL a,
ps_comm_ctxt_tbl b
where a.institution = b.institution
and a.comm_context = b.comm_context
and b.effdt =
(select max(c.effdt)
from ps_comm_ctxt_tbl c
where c.institution = b.institution
and c.comm_context =b.comm_context
and c.effdt <= %currentdatein
and c.eff_status = 'A')
and a.effdt =
(select max(d.effdt)
from PS_COMM_CA_CTX_TBL d
where d.institution = a.institution
and d.comm_context = a.comm_context
and d.comm_category = a.comm_category
and d.effdt <= %currentdatein)
|