Привет! > I can't figure out what is wrong with this: > > $query = "select count(*) as monthly_views from visitors group by > extract('year', time), extract('month', time) order by monthly_view desc > limit 1";
AFAIK this is no ANSI SQL, which is why is not portable. Your query should really be 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 *BUT* extract doesn't seem to be a MYSQL function, you most probably need to use DATE_FORMAT. Look in the Mysql docs for this. As a general ANSI rule group by functions *need* the fields on which result is grouped to appear *first* in the query. Take half an hour to look at the GROUP BY docs in MySQL online manual, everything will become much clearer. пока Альберто Киев -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ 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