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
 General SQL Server Forums
 New to SQL Server Programming
 total no of calls

Author  Topic 

rash901
Starting Member

8 Posts

Posted - 2014-11-10 : 23:20:26
i have "*** LOG: Call Center Transfer ***; No:1020 Status:noanswer; No:1021 Status:noanswerNo:1022Status:answeredCC Disconnected"
in my remarks column and i want to take the last no ie, whose status is answered.
then i want to see that wether the no is 1020 or 1021 or 1022 or 1023

basically i want to know totall no of call in each no...
please help...

AASC
Starting Member

24 Posts

Posted - 2014-11-11 : 00:33:35
Do you have any primary key or time stamp column in table?
Go to Top of Page

rash901
Starting Member

8 Posts

Posted - 2014-11-11 : 01:54:58
i have made the query but now the problem is that i want 'av' ie average to show in decimal coz right now @a is 1 and so av is showing value 0 where as it should show 0.25 i have used cast but nothing helped can u help me with this...
declare @a varchar(15), @c varchar(15),@av Float
SELECT @a=reverse(Substring(reverse(remarks),Charindex('tS',REVERSE(remarks))+2,4))

FROM [IVRS_MIS].[dbo].[logs] where app_name='IVFRT_POC' and remarks like '%answered%'

if @a = 1020
select no = '1020',b = Count(@a), av=COUNT(@a)/4
else if @a = 1021
select no = '1021',b = Count(@a), av = Count(@a)/4
else if @a =1022
select no = '1022', b = Count(@a), av = Count(@a)/4
else if @a =1023
select no = '1023',b = Count(@a),av=Count(@a)/4

FROM [IVRS_MIS].[dbo].[logs] where app_name='IVFRT_POC' and remarks like '%answered%'
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-11 : 09:05:36
Try casting the divisor to decimal(8,2)
Go to Top of Page

rash901
Starting Member

8 Posts

Posted - 2014-11-12 : 00:42:55
hey i used 4.0 instead of 4 now m getting ans as 0.250000(which i wanted) but i want only 0.25...
Go to Top of Page
   

- Advertisement -