[thelist] Re: MYSQL: getting distinct dates from a DATETIME field

Joshua Olson joshua at waetech.com
Sun Oct 5 10:59:56 CDT 2003


----- Original Message ----- 
From: "Dunstan Orchard" <dunstan at 1976design.com>
Sent: Sunday, October 05, 2003 9:41 AM


> SELECT DISTINCT
> DATE_FORMAT(event_date, '%b %D') AS event_dates,
> event_name, event_cost
> FROM event
> WHERE (event_type = 'exhibit hall')
> ORDER BY DATE_FORMAT(event_date, '%b %D') ASC
>
> But the output hasn't changed - it's still returning all three records :o/

When you specify DISTINCT, it doesn't just look at the column immediately
following... it looks at ALL the columns in the select list.  Therefore,
double check to make sure that the event_name and event_cost fields have
*exactly* the same value, no additional spaces, etc.

Good luck,

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168



More information about the thelist mailing list