日期:2014-05-18 浏览次数:20586 次
select convert(nvarchar(7),入职日期,120) 月份,count(工号) 人数 from tb where datapart(year,入职日期)=2011 group by convert(nvarchar(7),入职日期,120) having count(工号)<20
------解决方案--------------------
select convert(varchar(7),入职日期,120) as 月份,count(1) as 人数 from 员工表 where year(入职日期)=2011 group by convert(varchar(7),入职日期,120) having count(1)<20