How to calculate timestamp in SQL

Asked

Viewed 61 times

0

I have an INT Field (status) in the database, I have a script that updates it every 5 minutes using php time().

How do I calculate via sql?

Follow the select I’m using.

SELECT * FROM users WHERE status >= NOW() - INTERVAL 10 MINUTE

1 answer

0

do not know which DBMS you use I work a lot with Sqlserver 2014 and to perform this procedure of intevalo perform as follows

SELECT * FROM users WHERE status >= CAST((convert(datetime,getdate(),108)) + '00:10:00.000' as time(7)) 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.