i have table following layout :
+----+-----------+-------------+ | id | name | department | +----+-----------+-------------+ | 1| john | finance | +----+-----------+-------------+ | 2| bob | optics | +----+-----------+-------------+ | 3| jill | finance | +----+-----------+-------------+ | 4| jake | finance | +----+-----------+-------------+ | 5| mike | support | +----+-----------+-------------+
i want sum of people in each department :
+-----------+-------------+ | people | department | +-----------+-------------+ | 3| finance | +-----------+-------------+ | 1| optics | +-----------+-------------+ | 1| support | +-----------+-------------+
i having trouble constructing right query
use count
select count(name),department table group department
Comments
Post a Comment