Page 1 of 1

summing up time_worked with mysql query [solved]

Posted: Tue Sep 25, 2012 9:58 pm
by dr_patso
I'm working on a way to speed up my reporting..

I lost the format of the column type (time) when I add using this mysql query

Code: Select all



SELECT `hesk_categories`.`name` AS Category, sum( time_worked ) AS "Time Worked"
FROM hesk_tickets, hesk_categories
WHERE (
hesk_categories.id = hesk_tickets.category)
GROUP BY hesk_categories.name
  
the result loses the format.. =( not sure how i can keep the format in the query...

looks like this

category / time worked

User Access Requests 586536

Re: summing up time_worked with mysql query

Posted: Wed Sep 26, 2012 12:46 am
by dr_patso
nevermind got it!

Code: Select all

SELECT `hesk_categories`.`name` AS Category, SEC_TO_TIME( sum( TIME_TO_SEC( time_worked ) ) ) AS "Time Worked"
FROM hesk_tickets, hesk_categories
WHERE (
hesk_categories.id = hesk_tickets.category
)
GROUP BY hesk_categories.name