I’m trying to translate the PostgreSQL query:
SELECT * FROM mytable
WHERE last_check_timestamp + (INTERVAL '1 seconds')*interval_seconds <= now()
to an equivalent query in SQLite.
What I’m getting stuck on is how to dynamically create dates/intervals based on table columns. What’s the equivalent to “INTERVAL” in SQLite?
See the date and time functions for SQLite. You can say this to add 1 second to a datetime value for instance:
A full implementation of your example query might look something like this:
Demo: http://www.ideone.com/lbp3G