Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Need to convert Rows to columns - response (1) by dnoeth

$
0
0

Hi Praneeth,

select id1,
  max(case when id2='A' then Amt end) as A,
  max(case when id2='B' then Amt end) as B,
  max(case when id2='C' then Amt end) as C,
  max(case when id2='D' then Amt end) as D
from table a
group by 1;

You could also use three Outer Joins, but this is probably more efficient.
Dieter


Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>