> -----Original Message----- > From: JJ Harrison [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 09, 2002 12:33 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Bug in SQL can you help? > > > Here is my SQL(used in a PHP script so this isn't ot)
PHP-script or not, it's still an SQL-query, right? I'll give it a shot anyway... > SELECT > extract(year FROM time), > extract(month FROM time), > count(*) as monthly_views, > time > FROM > tececo_stats > group by > extract(year FROM time), > extract(month FROM time) > order by > monthly_views desc > limit 1 > > the problem is that is counts the number of rows in the whole > thing not the > echoed row. How can I get it count the best days only? SELECT CONCAT(YEAR(time), MONTH(time)) AS my_period, MAX(COUNT(*)) AS monthly_views FROM tececo_stats GROUP BY my_period /Joakim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php