Retrieving Date format rows in MySQL
I need to make a test on a Date field, so I can get the rows older than 29 days.
My Date field has this format : 2011-0开发者_StackOverflow中文版1-31 22:18:40
SELECT addeddate FROM status
WHERE addeddate // something to test if addeddate >= 29 days
Any ideas?
SELECT addeddate FROM status
WHERE addeddate <= NOW() - INTERVAL 29 DAY
Something like:
WHERE addeddate > DATE_SUB(NOW(), INTERVAL 29 DAY)
SELECT addeddate FROM status
WHERE DATEDIFF(NOW(), addeddate) >= 29
精彩评论