So i have 2 tables in each row, i used this to get the avg time in minutes.
SELECT Sec_to_time (Avg (Timestampdiff (second, `survival`, `lastupdate`)))
FROM main
But i want to get the hours, minutes, and seconds alone so i can echo them in php.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the MySQL HOUR(), MINUTE() and SECOND() functions to break the time returned from SEC_TO_TIME into its components.
To avoid having to repeat yourself, you can wrap the calculation:
SqlFiddle Here