|
发表于 2020-1-7 12:06:01
|
显示全部楼层
select
员工,
left(年月,4) as 年,
sum(加班工时) as 加班工时
from
(
select
员工,
convert(varchar(7),日期,120) as 年月
sum(加班工时) as 加班工时
from
表
group by
员工,
convert(varchar(7),日期,120)
having
sum(加班工时)>36
) as t
group by
员工,
left(年月,4)
having
sum(加班工时)>36*12
|
|