|
select
Employee,
left (year, month, 4) as year,
sum (overtime work) as overtime work
from
(
select
Employee,
convert (varchar (7), date, 120) as month
sum (overtime work) as overtime work
from
table
group by
Employee,
convert (varchar (7), date, 120)
having
sum (overtime work)> 36
) as t
group by
Employee,
left (year, month, 4)
having
sum (overtime work)> 36 * 12 |
|