In MySQL, using a query, is there a way to get total time in hours when the time is stored in minutes?

In the database, we have a numeric field that represents the total time in minutes for a doctor to evaluate a patient record. And, we have a report that groups by the doctor name and shows the total number of records in one column, the total number of minutes the doctor took to evaluate all of their records in a given time frame in the next column and the total average number of minutes it took for the doctor to evaluate their records during that time frame.

But, we have one customer who wants to see these numbers in hours, not minutes. Is there a way for me to do the division in the query or am I going to have to get the results in minutes and then divide by 60 for each doctor?

This question and answers originated from www.stackoverflow.com
Question by (10/17/2011 11:51:36 AM)

Answer

Something like:

SELECT doctor_id, SUM(minutes_spent) / 60 AS hours_spent
FROM that_table
GROUP BY doctor_id

Ideally I would do the math in my PHP script so that I won't have to mess with the queries every now and then. Customers have a mind of their own you know.

Answer by

Find More Answers
Related Topics  mysql
Related Questions