How can I pull data from a SQL Database that spans an academic year?
- by Eric Reynolds
Basically, I want to pull data from August to May for a given set of dates. Using the between operator works as long as I do not cross the year marker (i.e. BETWEEN 8 AND 12 works -- BETWEEN 8 AND 5 does not). Is there any way to pull this data? Here is the SQL Query I wrote:
SELECT count(*), MONTH(DateTime)
FROM Downloads
WHERE YEAR(DateTime) BETWEEN 2009 AND 2010 AND MONTH(DateTime) BETWEEN 8 AND 5
GROUP BY MONTH(DateTime)
ORDER BY MONTH(DateTime)"
Any help is appreciated.
Thanks,
Eric R.