I have an INT (Status) field in the database, I have a script that updates it every 5 minutes using php's time ().
How do I calculate via sql?
Follow the select I'm using.
SELECT * FROM users WHERE status >= NOW() - INTERVAL 10 MINUTE
I have an INT (Status) field in the database, I have a script that updates it every 5 minutes using php's time ().
How do I calculate via sql?
Follow the select I'm using.
SELECT * FROM users WHERE status >= NOW() - INTERVAL 10 MINUTE
I do not know which DBMS you use I work with SQLServer 2014 and to perform this inteval procedure I do the following
SELECT * FROM users WHERE status >= CAST((convert(datetime,getdate(),108)) + '00:10:00.000' as time(7))