SQL - Count per Person -
using mysql
lets have records in table columns:
personname, projecttype
personname contains names of people. projecttype contains types of projects, i.e. software, mechanical, etc.
goal:
i want select table number of projects per person. need both number of projects total, , number of projects per type.
how write sql this?
- number of total projects, per person
- number of projects per projecttype, per person
i want able data in personname, #ofprojects format.
i tried looking @ similar questions/answers, im not quite getting information want them.
number of total projects, per person
select person, count(*) totalprojectsperperson table group person
number of projects per projecttype, per person
select person, projecttype, count(*) totalprojectspertypeperperson table group person, projecttype
Comments
Post a Comment