MySQL Forums
Forum List  »  Newbie

SimplifyQuery
Posted by: Dhaval Mistry
Date: March 04, 2014 11:50PM

Hello , i am new to mysql i have query in which i use multiple time aggregate function ... can anyone help me to simplify the below query ...


SELECT concat(substring(cast(sum(timediff(otr.punch_out_user_time,otr.punch_in_user_time)) as char),1,1),":",substring(sum(timediff(otr.punch_out_user_time,otr.punch_in_user_time)),2,2),":",substring(sum(timediff(otr.punch_out_user_time,otr.punch_in_user_time)),4,2))from ohrm_attendance_record otr where otr.`employee_id` =2
AND otr.`punch_in_user_time` >= '2014-02-01'
AND otr.`punch_out_user_time` <= '2014-03-01' group by DATE(otr.punch_in_user_time);

i have the result 82500 from which i want to separate hour , minute and second part
for that i use the above query and get result like 8:25:00

Thanks in Advance

Options: ReplyQuote


Subject
Written By
Posted
SimplifyQuery
March 04, 2014 11:50PM
March 05, 2014 06:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.