The week data will have WeekBegin and weekend two fields that describe the start and end dates of the week.
Now the Calendar control in the project does not support the weekly query, only the date query, so the current problem is, according to the time range, query week.
The final SQL is as follows:
and date (weekend) <=date (' 2018-05-31 ')) or (date (weekbegin) <= (' 2018-05-01 ') and date (weekend) >=date (' 2018-05-31 ')) GROUP by Uid,weekbegin,weekend
Use the exhaustive method to do the processing, that is, to list out all the circumstances of the or query.
Simply say the logical thinking process:
The week start time End Time field is Weekbegin,weekend
The time range for page queries is begindate and enddate
Then the order of the four Time fields may be:
WeekBegin Weekend Begindate EndDate
1 2 3 4
1 3 2 4
1 4 2 3
2 3 1 4
3 4 1 2
The above SQL is finally drawn
SQL query, the week is queried based on the date range