简体   繁体   中英

MySQL Select rows where timestamp column between now and 3 minutes ago

I was looking at:

MySQL Select rows where timestamp column between now and 3 minutes ago

I have a col named time holding a time stamp: 11:06:42 PM

I would like to pull all records that are OLDER than 3 minutes using:

WHERE time >= TIME(NOW(),INTERVAL 3 MINUTE)

However the query always returns 0 results, even with items older then 3 minutes present in the database.

使用以下WHERE子句:

WHERE time < (NOW() - interval 3 minute)

使用MySQL Date_sub

WHERE time > Date_sub(now(), interval 3 minute)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM