我需要获取今年最后一个月的记录,但我也在获取过去几年的记录。请帮帮我
我有一个这样的查询:
select EmpCode,EventDate1 as EventDate,InTime,
case when OutTime is null then 'N/A' else Outtime end as OutTime from
TMS_HOURCALC WHERE DATEPART(m, EventDate) = DATEPART(m, DATEADD(m, -1, getdate()))
and empcode='13658'
GROUP BY EmpCode, InTime,OutTime, EventDate1,intime1
order by intime1;