sql count total calls

Category: PHP Questions    |    5 views
sorry to post it here.. i really need your attention..
thanx

hi guys! i am enim, i usually post thread in PHP and i guess its my first time here in mysql..

i have problem regarding the total count of the terminatecause..
i need the count of ANSWERED calls only and the total count of all calls..
can i do this in one query.. because my query below isn’t working..

pls. help

thanx
enim :)

select destination, count(terminatecause) as tc                                                        CASE terminatecause 
                                                                when ‘ANSWER’ then count(terminatecause)
                                                                end as allcall
                                                        from tblTable1
                                                        join tblTable2on tblTable1.someID = tblTable2.someID
                                                        join tblTable3on tblTable2.someID1 = tblTable3.someID1
                                                        where tblTable3.someID1= ‘1′
                                                        and tblTable1.someUser= ‘user’
                                                        and tblTable1.callstarttime between ‘2008-08-01 00:00:00′ and ‘2008-08-01 23:00:00′
                                                        group by destination, terminatecause order by destination asc

Share/Save/Bookmark

1 Star2 Stars
Loading ... Loading ...

0 responses so far!

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word