MySQL Forums
Forum List  »  Newbie

Re: Selecting distinct records
Posted by: Sean Nolan
Date: April 06, 2005 10:13AM

In fact I did make a typo :-( I left the GROUP BY out of the first one, so it should be

SELECT
wb.jobno, wb.waybillno, wb.dadd3, wb.shipdate, wt1.status, wt1.date, wt1.time
FROM waybill wb, waytrack wt1
WHERE acctno = 'ROBIN'
AND waybilltype='C'
AND wb.jobno = wt1.jobno
AND ADDTIME(CAST(wt1.date AS DATETIME), wt1.time) = (SELECT MAX(ADDTIME(CAST(wt2.date AS DATETIME), wt2.time)) FROM waytrack wt2 WHERE wt2.jobno = wb.jobno GROUP BY wt2.jobno)
ORDER BY wb.shipdate DESC

Sean Nolan

Options: ReplyQuote


Subject
Written By
Posted
April 06, 2005 09:07AM
Re: Selecting distinct records
April 06, 2005 10:13AM
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.