Skip to content
Advertisement

How Select record with where clause with math using ActiveRecord?

I want to return a list of records whose created_at more than 5 seconds before its updated_at

i.e.

But this syntax doesn’t appear to work. Getting the error:

Advertisement

Answer

You didn’t say what database you are using, but with MySQL you can the TIMEDIFF function for this:

If you are using Postgres:

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