Amy Anuszewski
Amy Anuszewski

Reputation: 1853

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?

Upvotes: 1

Views: 104

Answers (1)

Salman Arshad
Salman Arshad

Reputation: 272146

Something like:

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

Upvotes: 2

Related Questions