Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- elasticache
- spring
- spring test mvc
- OAuth 2.0
- Fiilter
- Spring Security OAuth
- spring camp
- spring boot devtools
- KSUG
- WebApplicationInitializer
- spring cloud
- ServletContextInitializer
- OAuth2.0
- spring security
- 스프링 부트
- spring-mybatis
- apache thrift
- 인텔리J
- 데브툴즈
- spring boot mybatis
- 스프링
- mybatis
- devtools
- spring boot 1.3
- 스프링시큐리티
- Spring MVC
- spring cloud config
- @MVC
- Multi DataSource
- Spring Boot
Archives
- Today
- Total
홍이의 개발 노트
오라클에서 SQL로 달력 만들기 본문
select min(decode(dd, 1, lvl)) as 일,
min(decode(dd, 2, lvl)) as 월,
min(decode(dd, 3, lvl)) as 화,
min(decode(dd, 4, lvl)) as 수,
min(decode(dd, 5, lvl)) as 목,
min(decode(dd, 6, lvl)) as 금,
min(decode(dd, 7, lvl)) as 토
from (select to_number(to_char(yyyy + level - 1, 'D')) as dd,
to_number(to_char(yyyy + level - 1, 'w')) as ww,
to_char(yyyy, 'D') as dd1,
level as lvl
from (select trunc(sysdate,'mm') as yyyy -- 원하는 달을 가져오기
from dual) -- trunc(sysdate, 'mm')
connect by level <= extract(day from last_day(sysdate))) -- 데이터 만들기
group by case when dd >= 1 and dd < dd1 then ww + 1 else ww end
order by case when dd >= 1 and dd < dd1 then ww + 1 else ww end
다른 테이블을 이용 하지 않고 달력 만들기