开发者

mysql query for date difference

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜