在Sql Server中按查询获取每周数据

时间:2015-04-01 15:42:23

标签: asp.net

我有一张桌子名称是' Emp_Attendance_New'谁记录了出勤率。当我发出这样一个给出特定结果的查询时。

查询:

Select Atendencedate ,Emp_Id,Attendance_Status ,EmpName  
from  Emp_Attendance_New  where Emp_Id ='20140160' 
and  Atendencedate between '3/30/2015' and '4/5/2015'

结果:

Atendencedate   Emp_Id     Attendance_Status     EmpName
2015-03-30  20140160    P           Vikash Prasad
2015-03-31  20140160    P           Vikash Prasad
2015-04-01  20140160    P           Vikash Prasad
2015-04-02  20140160    P           Vikash Prasad
2015-04-03  20140160    P           Vikash Prasad
2015-04-04  20140160    P           Vikash Prasad

但我只希望结果只有这样的单行:

Emp_Id      EmpName        2015-03-30    2015-03-31  2015-04-01   2015-04-02   
2014016   Vikash Prasad       P            P            P           P

0 个答案:

没有答案