title: generate reports in MYSQL between 2 dates grouped by week
body: <p>I have a staff timesheet table where i have timestamp of when those records are created. I now want to generate the report so that my start date is Tuesday and end date is next Monday, which is 1 week. Now i need to generate all the records grouped by this weeks time but will be next set of tuesday to monday. </p>
  
  <p>This is like normal GROUP BY WEEK(Timestamp) but the WEEK numbers are not the default ones i need to generate the reports in this custom duration. I have a query working for this which groups the record efficiently by Week 1, week 2, week 3 etc.. which is picked from default mysql calendar i guess. How can i change that to generate reports grouped by custom weeks ?</p>
  
  <p>Can you tel me how the following works as how the dates are picked up ?</p>
  
  <pre>
  SELECT WEEK(pw.date) AS Date,DATE_FORMAT(pw.date,'%d-%m-%Y') AS post_date,
  SUM(wages) AS amount,SUM(pw.hours) AS hours,SUM(pw.minutes) AS minutes
  FROM pos_sessions pw
  GROUP BY YEAR(pw.date), WEEK(pw.date) ORDER BY pw.date DESC</pre>