Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Where clause problem

Author  Topic 

DaveC11
Starting Member

43 Posts

Posted - 2008-06-24 : 04:45:08
I've got hte below statment that queries a database of call times. What i'm trying to do is display only the details of people who's call times exceed 1hrs. At the moment this is showing everyone. Could some please tell me where i'm going wrong?

SELECT extensionname as Consultant, format(SUM([duration]) * 0.000694444444 / 60, 'hh:mm:ss') as Duration
FROM calls
WHERE DATE = dateadd("d",-1,date()) and duration >= #01:00:00#
GROUP BY extensionname
order by format(SUM([duration]) * 0.000694444444 / 60, 'hh:mm:ss') desc

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-06-24 : 05:14:53
You can't use duration in the where clause. You can use it in the order by though.

SELECT extensionname as Consultant, format(SUM([duration]) * 0.000694444444 / 60, 'hh:mm:ss') as Duration
FROM calls
WHERE DATE = dateadd("d",-1,date()) and format(SUM([duration]) * 0.000694444444 / 60, 'hh:mm:ss') >= #01:00:00#
GROUP BY extensionname
order by Duration desc
Go to Top of Page

DaveC11
Starting Member

43 Posts

Posted - 2008-06-24 : 05:23:21
thanks for the reply. is it possible to select the top 33% the middle 33% and the bottom 33%??
Go to Top of Page
   

- Advertisement -