hoping you guys can help - I have a timestamp column in my db table and i want to run a query to find any records from that table wh开发者_StackOverflowere the timestamp is the same as 7 days from now (ignoring the hours, minutes and seconds). So far I have this but I'm certain it's not what i should be doing:
WHERE `import_date` = 'DATE_SUB(NOW(), INTERVAL 7 days)'
WHERE import_date = 'DATE_SUB(NOW(), INTERVAL 7 days)'
should be
WHERE import_date >= DATE_SUB(NOW(), INTERVAL 7 day)
days
should be day
for timestamp same as 7 day before from now use
WHERE DATE_FORMAT(`import_date`, "%Y-%m-%d") = DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 7 day), "%Y-%m-%d")
精彩评论