portabletelly Posted June 17, 2007 Share Posted June 17, 2007 Hi, I have a table called call_event. The call_events table has colum called Time_taken. Data in this colum is stored as a decimal vaulue. EG. 4hrs and 15 minutest would be stored as 4.25. I would like to be able to do a mysql query which give a total of all the returned values from a query but Im not quite sure what syntax I need. The query I would like to do is to find out the the total time for a call. I would imagen the query would be somthing like this Query = SELECT Time_Taken FROM call_event WHERE call_id ="$call_ID"; When running this query it will return all the times_taken which have the call_id field = to $call_ID. eg 4.5, 3.25 0.00 5.0 However what do I need to do get the total for all these values eg 4.5 + 3.25 + 0.00 + 5.00 = 12.75 I want to be do a query that will return the value of all the time_Taken added up for example in this case I wanted the query to return 12.75 Is this possible with just a query or do I need to do somthing funky with php to add up all the returned values? Quote Link to comment Share on other sites More sharing options...
bubblegum.anarchy Posted June 17, 2007 Share Posted June 17, 2007 SELECT sum(Time_Taken) FROM call_event WHERE call_id = $call_ID Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.