Привет! I forgot to add:
SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1 I take it that you have a *monthly_view* column in your table that is not the *monthly_views* alias yoiu use in your query. if that's a typo and you mean to order by the numebr of visitors (that is, you want the most visited month on top of the result) your query should probably look like: SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by 3 desc limit 1 That's because most databases (and I guess MySql is no exception) will not be able to use an alias in their GROUP BY, ORDER BY clauses. But you may want to try, maybe MySql *is* an exception, after all. пока Альберто Киев -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is....... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php