SELECT mail_id, count(member_id) AS `# of members` FROM yourtable GROUP BY mail_id;
At 18:44 -0800 3/17/03, Daren Cotter wrote:
I have a table that keeps track of when members of my site are mailed. The important fields in the table are: member_id, mail_id
I need to write a query that will return the # of members and # of mailings, like the table below:
# of mailings sent # of members ----------------------------------- 1 10,000 2 20,000 ... ...
Meaning, there are 10,000 members that have been sent 1 mailing, and 20,000 members that have been sent 2 mailings.
Is this possible in one query?
TIA,
Daren
-- _ __ __ +----------------------------------+ / | / /__ ____ _____/ /_ ____ _|Jeff Shapiro | / |/ / _ \/ __ \/ ___/ __ \/ __ `/|Photography and Graphic Design | / /| / __/ / / (__ ) / / / /_/ / |Colorado Springs, CO, USA | /_/ |_/\___/_/ /_/____/_/ /_/\__,_/ |www.nensha.com ||| [EMAIL PROTECTED]| +----------------------------------+
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php