Select a.cu_grcd
, count(case when b.cu_grcd = 'A' then a.cu_no else null end) as RANK_A
, count(case when b.cu_grcd = 'B' then a.cu_no else null end) as RANK_B
, count(case when b.cu_grcd = 'C' then a.cu_no else null end) as RANK_C
, count(case when b.cu_grcd = 'D' then a.cu_no else null end) as RANK_D
, count(case when b.cu_grcd = 'E' then a.cu_no else null end) as RANK_E
From
(
Select cu_no, cu_grcd
From CU_GRCD_T
Where ymn_cd= '200610' ) a ,
(
Select cu_no, cu_grcd
From CU_GRCD_T
Where ymn_cd= '200703' ) b
Where a.cu_no = b.cu_no
Group by a.cu_grcd
|
|
|