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

How to transpose rows to columns without the use of .sql and Bteqs - response (6) by Budda123

$
0
0
HI All, I too have same query(Need to Convert rows to cols anyone help me how to resolve it. Input:   Product     State          population        HSI             MP                  12             FIN             AP                   34             FDV            UP                   23             HSI             MP                  45 FIN              AP                  60 FDV             UP                  50 sel product, sum( case when state='AP' then population  else 0 end) as "AP", sum( case when state='MP' then population  else 0 end) as "MP", sum( case when state='UP' then population  else 0  end) as "UP" from WORK_TBLS_LOADS.Ptable  group by product;    output: product  AP     MP         UP FDV    0         0          73 FIN      94       0          0 HSI      0         57        0 Question: I need this query in dynamic way (There is fixed states). Please provide ur input.                                                                                                                                         

Viewing all articles
Browse latest Browse all 27759

Trending Articles



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