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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Please help with this query

Author  Topic 

bulubuk1976
Starting Member

24 Posts

Posted - 2008-09-05 : 19:49:24
I have a field "resolve"where possible values are "null" "1" "2" "3" "4" "5" I want to count all 1s 2s 3s 4s 5s in a separate field. How do I do that? Here is my existing query:

SELECT COALESCE (AVG(overallsat * 1.0), 0) AS overallsa, COALESCE (AVG(resolve * 1.0), 0) AS resolve, COALESCE (AVG(helpfulness * 1.0), 0) AS helpfulness, COALESCE (AVG(amtoftime * 1.0), 0) AS amtoftime, COALESCE (AVG(commskills * 1.0), 0) AS commskills, COUNT(EmpID) AS totalmonitorings FROM DBSalvador.dell_post_call_surveryform WHERE (CallDate >= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 22) AND (CallDate <= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 16)

Thanks!
Bulubuk

bulubuk1976
Starting Member

24 Posts

Posted - 2008-09-05 : 20:48:59
Let me clarify.....I have a fields overallsat, Resolve, helpfulness, amtoftime, commskills where possible values for each field are "null" "1" "2" "3" "4" "5" I want to count all 1s 2s 3s 4s 5s in a separate field for each mentioned field above like overallsatcount, resolvecount, etc... How do I do this? Here is my existing query:

SELECT COALESCE (AVG(overallsat * 1.0), 0) AS overallsa, COALESCE (AVG(resolve * 1.0), 0) AS resolve, COALESCE (AVG(helpfulness * 1.0), 0) AS helpfulness, COALESCE (AVG(amtoftime * 1.0), 0) AS amtoftime, COALESCE (AVG(commskills * 1.0), 0) AS commskills, COUNT(EmpID) AS totalmonitorings FROM DBSalvador.dell_post_call_surveryform WHERE (CallDate >= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 22) AND (CallDate <= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 16)

Thanks!
Bulubuk
Go to Top of Page
   

- Advertisement -