troubleshooting Question

mysql count and group by

Avatar of aej1973
aej1973 asked on
MySQL Server
4 Comments1 Solution205 ViewsLast Modified:
I have a table as follows:

id       name
1        Complete
2        Incomplete
2        Incomplete
1        packaged
3        complete
4        packaged
4        packaged

How can I do a count statement to get the following output:
complete  2
incomplete 1
packaged 2

The reason that "incomplete" is 1 is because it is grouped by id, the same is with "packaged".  Can someone let me know how I can get a count of "name"  by grouping by 'id" ?

Thank you,
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros