LevelThought
MIS
I am interested in displaying all accounts that had the first payor payment greater than 50 days after the discharge date. How should the following sql script be tweaked to correctly display the desired results?
(Note, payor payments are captured in the account payment detail table only under the displayed transaction codes.)
Select apd.account_no, ap.account_id, pe.discharge_date,
apd.payment_amount, apd.payment_date
from account_payment_detail apd, account_payor ap, preview_encounter pe
where account_no in
(select account_no from account_payment_detail
group by account_no
having min(payment_date) - trunc(pe.discharge_date) > 50
and ep.acount_id in ('A34','A35')
and apd.transaction_code in ('7003','7008','7009','7010')
and apd.account_no = ap.account_no
and ap.account_no = pe.account_no
Thanks in advance.
(Note, payor payments are captured in the account payment detail table only under the displayed transaction codes.)
Select apd.account_no, ap.account_id, pe.discharge_date,
apd.payment_amount, apd.payment_date
from account_payment_detail apd, account_payor ap, preview_encounter pe
where account_no in
(select account_no from account_payment_detail
group by account_no
having min(payment_date) - trunc(pe.discharge_date) > 50
and ep.acount_id in ('A34','A35')
and apd.transaction_code in ('7003','7008','7009','7010')
and apd.account_no = ap.account_no
and ap.account_no = pe.account_no
Thanks in advance.