我的表数据如下
FinishDate SpecialistName jobstate
----------------------- --------------- ---------
2012-10-01 00:00:00.000 Josh FINISHED
2012-10-01 00:00:00.000 Josh FINISHED
2012-10-01 00:00:00.000 Sam FINISHED
2012-10-01 00:00:00.000 Robin FINISHED
2012-10-01 00:00:00.000 Robin FINISHED
2012-10-01 00:00:00.000 Joy FINISHED
2012-10-01 00:00:00.000 Joy INCOMMING
2012-10-02 00:00:00.000 Joy FINISHED
我的查询如下
select Count(*) [Count] from employee
where convert(varchar,FinishDate,112)>='20121001'
and convert(varchar,FinishDate,112) <='20121001'
and JobState='FINISHED'
group by SpecialistName
如果某位专家在同一天完成多项工作,那么我想显示 1
如果 robin,josh & Sam 在同一天完成 10 个工作,那么当天将显示 3 个
然后输出会像
FinishDate Count
----------------------- ------
2012-10-01 00:00:00.000 3
2012-10-02 00:00:00.000 5
2012-10-03 00:00:00.000 15
所以请指导我如何自定义我的 sql 以获得期望的结果。谢谢