I am trying to write a query where I can eliminate a timediff of less than 2 minutes. I have tried variations on the following which returns no results
timediff(sessions.producer_on,sessions.producer_off)>'00:02:00'
the timediff without the > works fine and returns all results - I am having difficulty with the >00:02:00 condition. Can anyone help - many thanks
Change it to
timediff(sessions.producer_on,sessions.producer_off) > TIME('00:02:00')
and it should work.
This is probably the "old way" but it eliminates the need to check hours, days, etc.
UNIX_TIMESTAMP(fieldOne) - UNIX_TIMESTAMP(fieldTwo) < 120
You can also use NOW()
in place of a field name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With