Web Hosting Talk







View Full Version : mysql select syntax problems


cica
10-05-2006, 02:32 PM
Hi-

I am trying to do a mysql select statement against a table with a field of Real_Date of type DATE. This is the statement:


$result = mysql_query("SELECT Real_Date, Hour, Hits FROM STATS_BYHOUR WHERE Real_Date >= DATE_ADD(NOW(), INTERVAL -10 DAY)");


The problem is, the query is only returning from 2006-10-01 forward. I have several dates of 2006-09-30 that are being ignored.

Any help would be appreciated.

Thanks,
-Tom

oanielsen
10-05-2006, 03:34 PM
Try using CURDATE() rather than NOW(). NOW() produces a Timestamp, rather than just the date.

cica
10-05-2006, 04:43 PM
Thanks-

It turned out to be a different problem entirely. I didn't realize the data stream was being truncated. But, you'll be seeing another question real soon.

(I would have put a smiley face here, but I don't have 5 posts yet)

-Tom