In filed Data_cont i have a sequence of dates, similar:
01/06/2014
02/06/2014
05/02/2013
i need to exctrac only the value of month 6 and year 2014, i use this but dont work:-(
WHERE Month([DATA_CONT])='6'
WHERE with month
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: WHERE with month
You can use
WHERE Year([DATA_CONT])=2014 AND Month([DATA_CONT])=6
There are no single or double quotes around 2014 or around 6 because they are numbers, not text values. Another method would be
WHERE Format([DATA_CONT],'yyyymm')='201406'
Here we do need quotes around 201406 since the Format function returns a text value.
WHERE Year([DATA_CONT])=2014 AND Month([DATA_CONT])=6
There are no single or double quotes around 2014 or around 6 because they are numbers, not text values. Another method would be
WHERE Format([DATA_CONT],'yyyymm')='201406'
Here we do need quotes around 201406 since the Format function returns a text value.
Best wishes,
Hans
Hans