Help with Select Statement

Hello Everyone,

I have the following code that returns the first and last day of the month

SELECT DATE_SUB(curdate(),INTERVAL (DAY(curdate())-1) DAY);
SELECT LAST_DAY(now() - interval 1 day );

But I need a select statement similar to

SELECT a_field, a_date from a_table
WHERE a_date BETWEEN firstday_of_the_month AND last_day_of_the_month

Can someone help me build the statement correctly? please…

JM.

Re: Help with Select Statement

Be a bit more specific please.

what is the input for the query and what should be the output? maybe give an example to illustrate.

Re: Help with Select Statement

Can you just not use the between and use a_date >= DATE_SUB(curdate(),INTERVAL (DAY(curdate())-1) DAY) and a_date <= LAST_DAY(now() - interval 1 day )
Or you could also set variable in mysql and use those?

SET @mydate = LAST_DAY(now() - interval 1 day )

Regards,
Scott.