开发者

mysql query for date difference

开发者 https://www.devze.com 2023-01-29 04:54 出处:网络
I have a table record where I am storing开发者_开发问答 records of time like this: login_time ---------------

I have a table record where I am storing开发者_开发问答 records of time like this:

login_time
---------------
2010-12-08 13:40:57
2010-12-08 13:28:57
2010-12-08 13:10:57
2010-12-08 12:01:57
2010-12-08 11:05:57

I am using MySQL. I want to write a query to get all records which are less that "15 MINUTES" from current time.

can anyone help me out writting that query?


SELECT * FROM `table` WHERE `timestamp` > DATE_SUB(NOW(), INTERVAL 15 MINUTE)

Notice: don't write INTERVAL 15 MINUTES. It has to be MINUTE.

0

精彩评论

暂无评论...
验证码 换一张
取 消