943,657 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 765
  • MySQL RSS
Nov 19th, 2008
0

sql count total calls

Expand Post »
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

mysql Syntax (Toggle Plain Text)
  1. SELECT destination, count(terminatecause) as tc CASE terminatecause
  2. WHEN 'ANSWER' THEN count(terminatecause)
  3. END as allcall
  4. FROM tblTable1
  5. JOIN tblTable2on tblTable1.someID = tblTable2.someID
  6. JOIN tblTable3on tblTable2.someID1 = tblTable3.someID1
  7. WHERE tblTable3.someID1= '1'
  8. AND tblTable1.someUser= 'user'
  9. AND tblTable1.callstarttime BETWEEN '2008-08-01 00:00:00' AND '2008-08-01 23:00:00'
  10. GROUP BY destination, terminatecause ORDER BY destination asc
Last edited by peter_budo; Nov 20th, 2008 at 8:23 am. Reason: corecting code, no spaces inside the tag
Similar Threads
Reputation Points: 11
Solved Threads: 2
Light Poster
enim213 is offline Offline
40 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: Counting MySQL connections on a page
Next Thread in MySQL Forum Timeline: Inserting new row in mysql





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC