Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Transposed multiple rows into one column and one row - response (8) by KS42982

$
0
0
This is how I resolved my issue, that might help. WITH RECURSIVE base (c_rnk, c_list) AS ( SELECT rnk c_rnk, CAST(TRIM(columnname) AS VARCHAR(5000)) c_list FROM MYDB.MYTB WHERE rnk = 1 UNION ALL SELECT rnk c_rnk, b.c_list || ',' || CAST(TRIM(c.columnname) AS VARCHAR(5000)) c_list FROM MYDB.MYTB c INNER JOIN base b ON b.c_rnk + 1 = c.rnk ) SELECT  c_list FROM base QUALIFY RANK() OVER (ORDER BY c_rnk DESC) = 1 ;

Viewing all articles
Browse latest Browse all 14773

Trending Articles



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