Expand|Select|Wrap|Line Numbers
- SELECT 'BILLING' as "Repository", o.ORDER_ID as "Order ID", O.ORDER_DATE as "Date Ordered", s.SHIP_DATE as "Date Shipped", (s.SHIP_DATE-O.ORDER_DATE) as "Lag Time"
- FROM BILLING_DB.ORDERS o, BILLING_DB.SHIPPING s
- WHERE o.ORDER_ID = s.SHIP_ORDER_ID
- AND o.ORDER_ID = 4043
Repository Order ID Date Ordered Date Shipped Lag Time
BILLING 4043 12/01/2008 00:00:00 12/01/2008 00:00:00 0
BILLING 4043 12/01/2008 00:00:00 12/02/2008 00:00:00 1
But I only want it to return the first occurrence (the first time the order was placed/shipped).
Repository Order ID Date Ordered Date Shipped Lag Time
BILLING 4043 12/01/2008 00:00:00 12/01/2008 00:00:00 0
I tried using min(s.SHIP_DATE) but that still returned the same result set.
Any help is very appreciated.
Thanks.