GROUP BY

From: Date: Sun, 16 Aug 2009 20:50:18 +0000
Subject: GROUP BY
Groups: php.db 
Request: Send a blank email to php-db+get-46453@lists.php.net to get a copy of this message
I run a once daily e-mail list. The users are able to choose the time of day they receive their daily e-mail. Their preference is stored in the email-delivery_hour field. I am trying to determine which email_delivery_hour between 0 and 6 has the lowest number of subscribers. (I am trying to make it so the same number of e-mails are sent out every hour by offering this as the default when people sign up.) The GROUP BY section on mySQL's web site didn't make sense to me. I have attempted to start making the query (below). What additional changes to do I need to make? SELECT * FROM member_subscriptions WHERE list =1 AND email_delivery_hour <=6 GROUP BY email_delivery_hour ASC ORDER BY email_delivery_hour ASC LIMIT 1 Ron

« previous php.db (#46453) next »