> <!-- DISCLAIMER TO RUDY: I'm sorry.  I know. Bad Stephen. Proprietary
> Syntax is naughty. Feel free to show me the light. -->

there is no additional light to see, when it comes to mysql

if you use unix timestamp format, you must use the FROM_UNIXTIME function

this gives datetime values, thus MONTH, MONTHNAME and YEAR are also correct

DISTINCT is also correct, as you want unique results from multiple values per
month/year

now, your WHERE clause is where all the action is

and it's easier than you think  ;o)


SELECT DISTINCT
   MONTH(FROM_UNIXTIME(startDate)) as sMNum
 ,  MONTHNAME(FROM_UNIXTIME(startDate)) as sMName
 ,  YEAR(FROM_UNIXTIME(startDate)) as sYear
FROM event
WHERE endDate > UNIX_TIMESTAMP(current_date)
ORDER BY sYear, sMNum

in the WHERE clause, the UNIX_TIMESTAMP function is applied to a constant value,
with the result compared to your unix column value, rather than applying
FROM_UNIXTIME to your column value to compare to the current date constant value

this makes for indexability

also, notice that i've rearranged your ORDER BY into a more conventional
sequence


rudy
http://r937.com/







____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
       Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to