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