Re: Selecting distinct records
SELECT
wb1.jobno, wb1.waybillno, wb1.dadd3, wb1.shipdate, wt1.status, wt1.dateAndTime
FROM waybill AS wb1, waytrack AS wt1
WHERE acctno = 'ROBIN'
AND wt1 = 'C'
AND wb1.jobno = wt1.jobno
AND wt1.dateAndTime= (
SELECT MAX(dateAndTime)
FROM waytrack AS wt2
WHERE
wt2.jobno = wt1.jobno
GROUP BY
wt2.jobno
)
ORDER BY wb1.shipdate DESC
If I understood your question and your data, you want to select the most recent tracking record for each bill, right?
Never store date and time seperately, use a single DATETIME column.
Subject
Written By
Posted
Re: Selecting distinct records
April 06, 2005 09:18AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.