내용

글번호 206
작성자 heojk
작성일 2016-11-15 12:21:51
제목 cube & pivot sample
내용 select * from cust; select * from cntt; select * from ( select cn.cllt_fp_prno as fpno, nvl(cu.siu_cust_yn, 'A') as yn, count(*) as cnt from cntt cn, cust cu where cn.cust_id=cu.cust_id and cn.cllt_fp_prno is not null and cu.siu_cust_yn is not null group by cube(cn.cllt_fp_prno, cu.siu_cust_yn) ) pivot ( sum(cnt) for yn in('Y' as yes, 'N' as no, 'A' as ynall) ) order by fpno desc;