select 部门ID,count(case when 客户状态=0 then 1 else 0 end) ,
count(case when 客户状态=1 then 1 else 0 end),
count(case when 客户状态=2 then 1 else 0 end)
from 客户信息表  group by 部门ID