select name, SUM(count) from stats group by name;
-----Original Message----- From: news [mailto:[EMAIL PROTECTED]]On Behalf Of Max Clark Sent: Wednesday, December 11, 2002 4:05 PM To: [EMAIL PROTECTED] Subject: Newbie - group and tally help Hi- I am trying to write a sql query that will select, group and tally records returned. select name, count from stats order by name; foo 2 foo 4 foo 6 foo1 5 foo2 10 foo3 15 I would like the output to be like this: foo 12 foo1 30 How do I accomplish this in mysql? Thanks in advance, Max --------------------------------------------------------------------- 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 --------------------------------------------------------------------- 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