Jeff, That query simply gives me each mailing ID, along with the # of members associated with that mailing ID.
What I NEED is to return the # of mailings sent to a member, and the number of members associated with that number. I.e., if I do: SELECT count(*) FROM member_mailings WHERE member_id = 1 That returns the number of mailings for member 1, say it's 25. That would be one tally in the "25" field for # of mailings sent. It's tough to explain, so I'm thinking I won't be able to accomplish it in one query? --- Jeff Shapiro <[EMAIL PROTECTED]> wrote: > This should get you close: > > 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 > __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com --------------------------------------------------------------------- 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