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?

  1. number of total projects, per person
  2. 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

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -