Question: how to calculate hours between two times in sql?
Answer: The first solution to get the difference between two timestamps in one single query. To get the difference in hours, minutes and seconds, use this query, it works only if hours are smaller than 99. Change the total in seconds in Hours, Minutes and Seconds, for example with 3 hours = 3600 * 3 = 14400.