DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   sql count total calls (http://www.daniweb.com/forums/thread158443.html)

enim213 Nov 19th, 2008 11:19 pm
sql count total calls
 
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


All times are GMT -4. The time now is 4:00 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC