summing up time_worked with mysql query [solved]

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

summing up time_worked with mysql query [solved]

Post 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
Last edited by dr_patso on Wed Sep 26, 2012 12:47 am, edited 1 time in total.
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: summing up time_worked with mysql query

Post 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
Post Reply