呵呵,太客气啦!昨天贴的不清楚,应该是这样,这样看就清楚了吧
select T1.姓名, (select Count(*) from 表名 T2 where T2.状况 = '门诊' and T2.姓名 = T1.姓名) as 门诊
,(select Count(*) from 表名 T2 where T2.状况 = '保健' and T2.姓名 = T1.姓名) as 保健
,(select Count(*) from 表名 T2 where T2.状况 = '学习' and T2.姓名 = T1.姓名) as 学习
from 表名 T1
group by T1.姓名