mysql에서 week(date)
This function returns the week number for date
. The two-argument form of WEEK()
enables you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range from 0
to 53
or from 1
to 53
. If the mode
argument is omitted, the value of the default_week_format
system variable is used. See Section 5.1.5, “Server System Variables”.
The following table describes how the mode
argument works.
Mode | First day of week | Range | Week 1 is the first week … |
---|---|---|---|
0 | Sunday | 0-53 | with a Sunday in this year |
1 | Monday | 0-53 | with 4 or more days this year |
2 | Sunday | 1-53 | with a Sunday in this year |
3 | Monday | 1-53 | with 4 or more days this year |
4 | Sunday | 0-53 | with 4 or more days this year |
5 | Monday | 0-53 | with a Monday in this year |
6 | Sunday | 1-53 | with 4 or more days this year |
7 | Monday | 1-53 | with a Monday in this year |
For mode
values with a meaning of “with 4 or more days this year,” weeks are numbered according to ISO 8601:1988:
If the week containing January 1 has 4 or more days in the new year, it is week 1.
Otherwise, it is the last week of the previous year, and the next week is week 1.
그런데 내가 요청받은 것.
토요일부터 금요일까지를 한주로 계산해서 뽑아주세요...
힝....
'개발개발 > mySql' 카테고리의 다른 글
DB를 쿼리로 업데이트 할때 (0) | 2018.09.16 |
---|---|
mysql 월/주차 구하기 (1) | 2018.01.06 |
left join 시 속도 문제 (0) | 2016.12.20 |
SELECT 정렬하기 정리 (0) | 2016.12.13 |
order by varchar to int (0) | 2016.11.24 |