How do I select arbitrary date ranges in a MySQL query
Posted on 2009-07-15
I need a query/code snippet that would allow me to get a date-range from the previous Friday night until now. I have figured out how to get date results from the last 7 days, but I need them specifically from last Friday.
On a slightly different note, but related to the same project, I need some code that would allow me to get results from each disparate month of the 12 months, starting with a year ago. For example, I need to return the number of orders within dates of July 1st - the 31st of 2008, August 1st - 31st of 2008, ... up to July 1st - 31st of 2009. This data will be fed into a dynamically created chart, so it has to all move along dynamically with the current date.