current month with rolling previous 6 months in mysql

I am trying to report numbers back rolled up by month for the past 6 months based off of the current_date() field.  I tried using date_add(month(current_date()),INTERVAL -6 MONTH) but that does not work.  

I did have date_add(current_date(),INTERVAL -6 MONTH) in place but that is not totally accurate because if i run the query in the second week of the month then the first month (october) will only have numbers for the remaining two weeks.  I need it by month.
szadrogaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PortletPaulEE Topic AdvisorCommented:
This will provide an accurate date range filter for the past 6 months.
select * from table1
where  `dt` >= date_add(date_add(LAST_DAY(current_date()), INTERVAL 1 DAY), INTERVAL -6 MONTH)
and `dt` < date_add(LAST_DAY(current_date()), INTERVAL 1 DAY) 

Open in new window


Note this does NOT use between deliberately. See "Beware of Between"

nb: this assumes you want "whole months" only including the current month. You mention October however (In April October 7 months ago).
Do you want to exclude the current month?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
szadrogaAuthor Commented:
the LAST_DAY() did the trick. thx!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.