내용 |
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; |