|
select a.business_unit,
a.cashier_office,
a.cashier,
b.tender_key,
c.descr
from ps_csh_off_cashier a,
ps_tender_cshr_tbl b,
PS_TENDER_KEY_TBL c
where a.business_unit = b.business_unit
and a.cashier = b.cashier
and b.effdt = c.effdt
and b.business_unit = c.business_unit
and b.tender_key = c.tender_key
and c.effdt =
(select max (e.effdt)
from PS_TENDER_KEY_TBL e
where c.business_unit = e.business_unit
and c.tender_key = e.tender_key
and e.effdt <= %currentdatein)
and c.eff_status = 'A'
and c.tender_category in ('CC','CK','CS','DB','DD','TP')
and b.in_allowed = 'Y'
|