Extract records from Query based on month

  • Thread starter Thread starter SeRene
  • Start date Start date
S

SeRene

Hi,

I have this table which shows dates in Long Date format,
i.e. Monday, January 1, 2004. How can i extract ALL
January records in a query criteria??

Thanks.
 
When you say "shows", do you mean the actual field is a date field?

If yes, then in your query simply go:

select * from tblYourTable where month(MyDate) = 1 and year(MyDate) = 2004

The above assumes your table name is tblYourTable, and the date field is
MyDate.

The above also assumes you actually want only records from this years
January. If you want "all" records from January..regardless of year..then of
course you just leave the year thing out.

Remember, any date field is stored in a nice "internal" format. You can
display the date anyway you want...but internally it is still just a single
number. That is why you can do the above.

On the other hand, if that field is NOT a date field, then I would convert
the data to a date field...and again use the above...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top