我有一张桌子(电话),告诉我员工在帐户上花了多长时间 数据如下:
Date Agent Talk_Time Updt_Time
01/10/2013 One 55 98
01/10/2013 Two 73 129
01/10/2013 Three 101 84
02/10/2013 One 65 99
02/10/2013 Two 87 122
02/10/2013 Three 130 80
03/10/2013 One 8 90
04/10/2013 Two 13 110
05/10/2013 Three 100 85
06/10/2013 One 50 91
07/10/2013 Two 70 120
08/10/2013 Three 10 89
我正在尝试找到员工的MAX谈话和更新时间 我需要的另一个附加功能是查看7天的时间 所以在过去的七天里,数据看起来应该是这样的:
Agent Talk_Time Updt_Time
One 65 99
Two 87 122
Three 130 89
答案 0 :(得分:0)
很简单!!!
select agent,max(Talk_time) as talk_time,max(updt_time) as updt_time from table group by agent
答案 1 :(得分:0)
select agent,max(talk_time) as talk_time,max(updt_time) as updt_time from calls group by agent