1 select * from 2 (select cd,nm,num,js from test where rq='avc') 3 pivot (sum(js) for num in('Y20','J31','X47B')) 4 5 6 7 EXTEND 8 9 10 select row_number() over (order by cd) rn, t.* from 11 (select cd,nm,num,js from test where rq='avc') 12 pivot (sum(js) for num in('Y20','J31','X47B')) t