日期:2014-05-17 浏览次数:20496 次
select a.deptno
from #stuinfo as a
inner join #studatetime as b on a.sno = b.sno
where b.starttime > '2012-7-01 00:00'
and b.starttime < '2012-07-31 23:59'
and (DATEPART(HOUR, b.starttime) > 9 or (DATEPART(HOUR, b.starttime) = 9 and DATEPART(MINUTE, b.starttime) > 40))
group by a.deptno having COUNT(*) >= 3