我需要从 sqlserver2008r2 获取记录,我获取当前一周记录的查询是:
select EmpCode,EventDate1 as EventDate,InTime,
case when OutTime is null then 'N/A' else Outtime end as OutTime from
TMS_HOURCALC WHERE intime1
BETWEEN dateadd(dd,(datediff(DD,-53684,getdate())/7)*7,-53684)
AND dateadd(dd,((datediff(dd,-53684,getdate())/7)*7)+7,-53684)
and empcode = @empcode
GROUP BY EmpCode, InTime,OutTime, EventDate1,intime1
order by intime1;
任何人都请帮助我仅从上周日到上周六获取上周的记录。