SELECT * WHERE month = March (1 Viewer)

danb

Registered User.
Local time
Today, 05:32
Joined
Sep 13, 2003
Messages
98
Hi,

I've got a news table in an Access database, with the following fields/datatypes:

Code:
=====
tblNews
=====
news_id (auto number)
news_headline (text field)
news_article (memo field)
news_date (date field)

I have a select statement from an ASP page like so:

Code:
SELECT * FROM tblNews ORDER BY news_date DESC;


What I need to be able to do, is to select all news articles from a particular year or all articles from a particular month, so the above statement needs to be something like this:

Code:
SELECT * FROM tblNews WHERE news_date = 'March' ORDER BY news_date DESC;

Clearly the above code doesn't work, since I'm passing a string into a date field, but this is the kind of thing I need to achieve.

Can this be done, and if so, how?

Thanks for any pointers...
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 21:32
Joined
Aug 30, 2003
Messages
36,140
WHERE Month(news_date) = 3
 

danb

Registered User.
Local time
Today, 05:32
Joined
Sep 13, 2003
Messages
98
Perfect, that's just what I was looking for, thanks!
 

Dennisk

AWF VIP
Local time
Today, 05:32
Joined
Jul 22, 2004
Messages
1,649
you nedd to check for the year as well as searching for month will Select Mar 89 Mar 90 etc....
 

Users who are viewing this thread

Top Bottom