본문 바로가기
Database/MYSQL

몇주 정보 추출

by 반화넬 2007. 6. 4.
반응형
select week('2004-12-31', 0) d31
 ,week('2004-12-31', 2) d31
 ,week('2005-01-01', 0) d1
 ,week('2005-01-01', 2) d1
 ,week('2005-01-02', 0) d2
 ,week('2005-01-02', 2) d2
;
select week('2005-01-31', 0) d31
 ,week('2005-01-31', 2) d31
 ,week('2005-02-01', 0) d1
 ,week('2005-02-01', 2) d1
 ,week('2005-02-09', 0) d9
 ,week('2005-02-09', 2) d9
;
select week('2005-01-01', 0) d1
 ,week('2005-01-02', 0) d2
 ,week('2005-01-09', 0) d9
 ,week('2005-01-31', 0) d31
 ,week('2005-01-01', 0) - week('2005-01-01', 0) + 1 w1
 ,week('2005-01-02', 0) - week('2005-01-01', 0) + 1 w2
 ,week('2005-01-09', 0) - week('2005-01-01', 0) + 1 w9
 ,week('2005-01-31', 0) - week('2005-01-01', 0) + 1 w31
;



select week('2005-01-01', 0) j1
 ,week('2005-02-01', 0) d1
 ,week('2005-02-02', 0) d2
 ,week('2005-02-09', 0) d9
 ,week('2005-02-28', 0) d28
 ,week('2005-02-01', 0) - week('2005-02-01', 0) + 1 w1
 ,week('2005-02-02', 0) - week('2005-02-01', 0) + 1 w2
 ,week('2005-02-09', 0) - week('2005-02-01', 0) + 1 w9
 ,week('2005-02-28', 0) - week('2005-02-01', 0) + 1 w28
반응형