khott (8/18/2014)
Hello all,So I am trying to figure out a way to present the number of records for a 3 month window and for the same date. I know not all months have 31 days so it would need to be smart enough so it does not error out. This is kinda the manual way to help you understand what I am looking for:
select count(learner_id) TheCount, month(creation_date) TheMonth from learner_info
where creation_date between '8/1/2014' and '8/18/2014'
or creation_date between '7/1/2014' and '7/18/2014'
or creation_date between '6/1/2014' and '6/18/2014'
group by month(creation_Date)
Keep in mind, tomorrow all three dates will need to be the 19th and the next day the 20th and so on.
Thank you in advance.
Kam
I don't know if your creation_date column has times in it but remember that BETWEEN is INCLUSIVE of both end points.
--Jeff Moden
Change is inevitable... Change for the better is not.