At 20:52 -0400 5/1/02, Anthony W. Marino wrote:
>Try this:
>
>SELECT a, b FROM tblName WHERE TO_DAYS(NOW()) - TO_DAYS(pubDate) <= 7;
>
>Anthony
SELECT a, b FROM tblName WHERE pubDate >= DATE_SUB(NOW(),INTERVAL 7 DAY);
will probably be faster if pubDate is indexed. The first query
above puts pubDate in an expression, which makes indexes inapplicable.
>
>
>> What is the proper query for slect all from the past
>> number of days.
>>
>> i.e. I would like to return all articles from the past
>> week. Right now I am using SELECT blah, bla FROM table
>> WHERE pubDate BETWEEN CURDATE() - 7 AND CURDATE() AND
>> whatever = 'whatever'
>>
>> This worked fine until today. the first of month.
>>
>> Thanks much,
> > olinux