Skip to content
Advertisement

Comparing TIMEDIFF in MySQL

I have these following data:

and the following query that I want to use to find all the entries where the timediff is lesser than 50 hours

The second row should be returned because it’s lesser than 50 hours, but the first row, which the timediff is more than 50 hours keep returning as well.

It returns all sort of value, including those larger than 50

What query should I be using? Thank you

Advertisement

Answer

Try getting the difference in hours and then comparing.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement