MySQL Forums
Forum List  »  Newbie

Selecting distinct records
Posted by: Rob Burne
Date: April 06, 2005 09:07AM

Hi I am using this select statement to join two tables, waybill and waytrack.

SELECT
waybill.jobno, waybill.waybillno, waybill.dadd3, waybill.shipdate, waytrack.status, waytrack.date, waytrack.time
FROM waybill, waytrack
WHERE acctno = 'ROBIN'
AND waybilltype='C'
AND waybill.jobno = waytrack.jobno
ORDER BY waybill.shipdate DESC

I want to modify the query though, selecting only distinct waybill.waybillno records. If 2 records do exist with the same value for waybill.waybillno I want to select the latest entry (therefore sorting on the waytrack.date, and further waytrack.time in the event of the date being the same).

If anyone could help I would appreciate it.

Thanks,

Rob Burne.

Options: ReplyQuote


Subject
Written By
Posted
Selecting distinct records
April 06, 2005 09:07AM
April 06, 2005 02:15PM
April 06, 2005 02:43PM
April 06, 2005 03:40PM


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.