I'm trying to create a report which allow the user to choose a starting month and a starting year, then it will also allow the user to choose a ending month and ending year.
My problem is:
- for example, the starting month and starting year is June, 2010 ; the ending month and ending year is September 2011. The report should be able to display all the data within the range by uisng BETWEEN...AND, here is my sql statement:
(MONTH(Maintenance_DateTime) BETWEEN @startmonth AND @endmonth) AND (YEAR(Maintenance_DateTime) BETWEEN @startyear AND @endyear)
I'm using this sql statement and it ends up not displaying the data with the month October year 2010.
If I choose the ending month to be October and the ending year 2011, then the report will only display the data with the month October year 2010.
Can anyone help me to check what is wrong with my sql statement?
View Complete Post