Just implement it as how it's written:
Code:
SELECT * FROM my_table
WHERE 'date' BETWEEN date(extend(today, YEAR TO MONTH))
AND date(extend(today, YEAR TO MONTH) +1 UNITS MONTH) -1 UNITS DAY;
if the builtin function TODAY evaluates to a date in december and you want the results of december.
If in december you want the results of november write:
Code:
SELECT * FROM my_table
WHERE 'date' BETWEEN date(extend(today, YEAR TO MONTH) -1 UNITS MONTH)
AND date(extend(today, YEAR TO MONTH)) -1 UNITS DAY;
The thing with the EXTEND function is that it transforms a date(time) to a subset of years, months, days (hours, minutes, seconds, fractions) according to the specifications (in this case YEAR TO MONTH). By adding 1 month you get a valid datepart that complies with the calendar (adding 1 month to 2009-12 returns 2010-01). Casting with the enclosing DATE function adds the first day of a month to it, i.e. 2010-01-01.
For getting the last date of a given month you can do the same with first adding one month to the adjusted date, then cast it to the first day of the next month and finally subtract one day to get the last day of the month before, i.e. 2009-12-31.
Regards,
Hans