Code:
"SELECT *, DATE_FORMAT(logdate,'%c/%e/%y') as logdate FROM daily WHERE TO_DAYS(NOW()) - TO_DAYS(logdate) <= 7"
Returns all records, regardless of date.

Code:
SELECT *, DATE_FORMAT(logdate,'%c/%e/%y') as logdate FROM daily HAVING TO_DAYS(NOW()) - TO_DAYS(logdate) <= 7
Returns no records, even through there are several matching the query in the table (logdate is a DATETIME column).

Any ideas?