How to select the matching details from table mysql query equal to current date
I have read the topic Mysql query: retrieve current date query ., but my question is how can i select the row in a particular given time span.
i.e if my date field is having t开发者_运维技巧he entry as 2010:10:27 10:30:00 then that row should be selected when the current time reaches 2010:10:27 10:00 and until the current time reaches the 2010:10:27 18:30:00 . like that. Any help on this would do a great benefits for me..
thanks in advance
Have you checked out the BETWEEN operator? I think it will be helpful to you. Maybe something like this:
WHERE
field
BETWEEN
DATE_SUB(NOW(), INTERVAL 8 HOURS)
AND
DATE_ADD(NOW(), INTERVAL 30 MINUTES)
精彩评论