Given records containing a date field, how do you select
all records where the month portion of the date equals a
given month? Same with the date portion equaling a
given date?
Most data base systems provide some function to extract the year/month/date portions from a date value, such as SELECT *
FROM mytable
WHERE month(mydatefield) = wantedmonth
There should be further functions to select year(mydatefield) and day(mydatefield) .
I recommend posting Access query questions in forum701, "Microsoft: Access Queries and JET SQL." Access JETS SQL differs from ANSI SQL in many ways.
Either Month(datecol) or datepart("mm",datecol) will return the numeric value of the month. You may want to consider adding "Year" to the selection criteria if the tables contains multiple years of data. Terry L. Broadbent - DBA
Computing Links:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.