How to calculate timestamp in SQL

0

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
    
asked by anonymous 11.02.2016 / 22:42

1 answer

0

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)) 
    
11.02.2016 / 23:34