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
- spring cloud config
- spring boot devtools
- ServletContextInitializer
- OAuth 2.0
- Multi DataSource
- 스프링 부트
- KSUG
- spring test mvc
- Spring Security OAuth
- apache thrift
- devtools
- WebApplicationInitializer
- Spring Boot
- 데브툴즈
- 스프링시큐리티
- @MVC
- elasticache
- mybatis
- spring cloud
- 스프링
- spring-mybatis
- OAuth2.0
- spring security
- spring
- spring boot mybatis
- Spring MVC
- Fiilter
- 인텔리J
- spring boot 1.3
- spring camp
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
다른 테이블을 이용 하지 않고 달력 만들기