简体   繁体   中英

Why is this not selecting only records with a date older than 7 days?

I am trying to filter for rows that have a value of '1' in the active column and where the date in the lastfollowupemail_date column is 7 days or older from the current date.

Searching on the internet on many sites, this is the query I came up with, but for some reason it is not filtering correctly (the query is selecting records with a date less than 7 days from the current time).

Any ideas on why this may be occurring would be fantastic and much appreciated. Thank you so much in advance!

SELECT * FROM e_sales_prospects
WHERE active='1' 
AND lastfollowupemail_date > DATE_SUB(NOW(), INTERVAL 7 DAY)

如果我没有看错,那么您想要的行要早于7天,在这种情况下,您希望行的日期要短一些,所以我认为

lastfollowupemail_date < DATE_SUB(NOW(), INTERVAL 7 DAY)

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