I have what is probably a very simple problem but after an hour i am stumped on the syntax to use.
I am working with a database that holds date information in one column in the usual format, yyyy-mm-dd.
What I am trying to do is retrieve all records from today going back 6 months. What I have at the moment is;
Code: Select all
SELECT * from adgroup_data WHERE date >=DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) order by date"1) Look at the current date
2) Find the Monday before this date
3) Retrieve 6 mths data from this date
4) Group that data into weeks (7 days)
5) Display only the summarised weekly totals for the data
I realise the database date column perhaps isn't the best in terms of format however I am having to work with this at the moment whilst I build a better DB!
I would appreciate any help you can give.
Kind regards
Peter