Re: Select Past 7 days

2002-05-01 Thread Anthony W. Marino
Try this: SELECT a, b FROM tblName WHERE TO_DAYS(NOW()) - TO_DAYS(pubDate) <= 7; Anthony > 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

Re: Select Past 7 days

2002-05-01 Thread Paul DuBois
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 pub

Select Past 7 days

2002-05-01 Thread olinux
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 o