Hi. What you see is described in the section about "Known Errors and Design Deficiencies in MySQL":
http://www.mysql.com/doc/B/u/Bugs.html In short, the problem is that you ORDER by a column which does not appear in the SELECT clause. Something that is not allowed in ANSI SQL and not fully supported with MySQL: For JOINs it behaves as if the column in question silently appeared in the SELECT clause, therefore influencing what DISTINCT works on. Bye, Benjamin. On Mon, May 20, 2002 at 02:56:22PM -0700, [EMAIL PROTECTED] wrote: [...] > We choose a distinct a.oprid and if we leave out the "order by > a.effdttime desc" the query gives what I want, but when adding it, I > get extra info thats uneeded. If you need more info please reply as > I hope I put everything needed here Thanks > > select distinct a.oprid, a.id, b.firstname, > b.lastname, b.work_note, client_status, b.work_dt time > from oprid_client_history a, cust b where > a.id=b.custid and a.oprid='david' and a.effdttime >= > curdate() order by a.effdttime desc [...] -- [EMAIL PROTECTED] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php