MySQL Forums
Forum List  »  Newbie

Custom Defined Week/Date Range Help
Posted by: Andrew Leonard
Date: January 31, 2017 01:30PM

I'm using MySQL Workbench and a 3rd party business intelligence platform that is connected to our database to format (aka make pretty) the outputs of the queries.

This question is primarily regarding the query setup. I have a query that outputs a "Leaderboard" of sales for our reps over the past week (rolling 7 days).

Currently, the previous week is set up as a rolling total of the past 7 days (including today) by using this:

WHERE sale_date BETWEEN curdate() - INTERVAL 6 DAY AND curdate()

This works great for giving me the numbers on a rolling week. However, I want to be able to find the numbers for the current work week (eventually the previous week too, but I can derive that from y'alls answers). To further make matters more complex, our work week isn't a normal work week. I would need to define our work week as "Friday to Thursday". If at all possible I would like to define this directly into the query as I don't have backend access to our SQL server (but I can get it if it's going to be impossible to do without).

I've tried searching around and tried a few things but haven't had any luck. I know my way around MySQL enough for the basics plus a little extra, but this seems to be way above my head.

Any help or direction will be greatly appreciated on how I can accomplish this.

Options: ReplyQuote


Subject
Written By
Posted
Custom Defined Week/Date Range Help
January 31, 2017 01:30PM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.