>This gives me one instance of each file name in the DOCUMENTS column
>submitted into the database. The only thing though is it gives me the
>oldest of the file name in the DOCUMENTS column which are submitted. Any
>ideas how to get the newest one? I've tried adding: , MAX(ID) after the
>SELECT *. It still gives me the oldest ones submitted.
>
>NOTE: ID is my unique id column(primary key).
>
>SELECT *
> FROM content
> WHERE dtype ='Events' and Department ='Marketing'
> GROUP BY Document
> ORDER BY cdate DESC
Sir, the problem is that MySQL doesn't get the other values from the
same row it got Max(ID) from. It is returning values from the first
row of each group. (ORDER BY has no effect, since it is applied after
the GROUP BY.) I've got a description of this problem and two
workarounds at http://users.starpower.net/rjhalljr. Click on MySQL on
the sidebar, click on MySQL SQL, and look for the first topic in the
Aggregate Function section of the Strictly SQL section.
Bob Hall
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
---------------------------------------------------------------------
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