The easiest way is to add a RANK:
select ca8172.*
,ord.order_due_dt as ORD_DUE_DT
,ord.cust_reason_txt as RSN_TXT
,ord.order_reason_cd as ORD_RSN_CD
from ORDER_ACTION ord, ca8172_AcctCharge ca8172
where ord.acct= ca8172.acct
and ord.bypass_reason_cd = 'VS'
and ord.current_status_cd = 'DO'
and ord.order_reason_cd in ('VA','ML','DR')
qualify rank() over (order by ORD_DUE_DT desc) = 1
If you want to get the most current date for different groups, e.g. per ACCT simply add "PARTITION BY ACCT" before the ORDER BY
Dieter
The easiest way is to add a RANK:
If you want to get the most current date for different groups, e.g. per ACCT simply add "PARTITION BY ACCT" before the ORDER BY
Dieter