Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » SQL




 Page 1 of 1 [ 2 posts ] 



Author Message
 Post subject: how 2 count if the condition was true
 Post Posted: Sat Nov 21, 2009 2:13 pm 
Offline

Joined: Sat Feb 21, 2009 11:41 am
Posts: 45
I need a help guyS!!!!. How do I include a resolve count field dat
generally counts da number of 0s nd 1s combind 4m da resolve field?
Here is ma existing query:

[code]
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') - 29) AND (CallDate <= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 23)
[/code


Top 
 Post subject: Re: how 2 count if the condition was true
 Post Posted: Sat Nov 21, 2009 2:13 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
may be this:-

Code:
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,SUM(CASE WHEN resolve=1 THEN  1 ELSE 0 END) AS resoved,SUM(CASE WHEN resolve=1 THEN  1 ELSE 0 END) AS unresoved
FROM DBSalvador.dell_post_call_surveryform WHERE (CallDate >= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 29) AND (CallDate <= DATEADD(DAY, DATEDIFF(DAY, '19000107', GETDATE()) / 7 * 7, '19000107') - 23)



Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 2 posts ] 




Board index » Server Side Development » SQL


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron