_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈 |
FrontPage › 막대그래프
|
|
[edit]
응용 예제3 #이 문제는 sqler.pe.kr에서 발견한 문제(
![]() 원하는 결과 num a b c d e ----------- ---- ---- ---- ---- ---- 5 ▒ 4 ▒ 3 ▒ ▒ 2 ▒ ▒ ▒ 1 ▒ ▒ ▒ ▒ 0 ▒ ▒ ▒ ▒ ▒ NULL 1 3 5 0 2 --쿼리 결과는 텍스트로 보고 고정길이 폰트(~~체)로 보면 된다. 옵션 바꾸는거 귀찮으면 메모장으로 복사해서 보면 된다. with temp(num) as ( select 6 numm union all select num - 1 from temp where num - 1 >= 0 ), val(a,b,c,d,e) as ( select '1' a, '3' b, '5' c, '0' d, '2' e ) select case when b.num = 0 then null else b.num - 1 end num , case when b.num = 0 then a when b.num - 1 <= a.a then '▒' else '' end a , case when b.num = 0 then b when b.num - 1 <= a.b then '▒' else '' end b , case when b.num = 0 then c when b.num - 1 <= a.c then '▒' else '' end c , case when b.num = 0 then d when b.num - 1 <= a.d then '▒' else '' end d , case when b.num = 0 then e when b.num - 1 <= a.e then '▒' else '' end e from val a cross join temp b
|
어떤 말을 만번 이상 되풀이 하면 반드시 미래에 그 일이 이루어진다. (아메리카 인디언 금언) |