I want to search whether selected month is in between months;
for example:
- jan-2011 is between jan-2011 and march-2011
- apr-2011 is not between feb-2011 and march-2011
how do I select only if selected month-year is between month1 and month2 in mysql?
both month1 and month 2 are using datetime data type.
You could construct a Date for each and then use the “BETWEEN” clause in your query.
i.e.
select * from table where datecolumn between “01/01/2001” and “03/01/2001”.