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

Pivot Data by Month - response (1) by ulrich

$
0
0
Can you please provide a DDL and insert statement for your test data? It is not really clear if state_ind has the values '1 AL' etc. And does the source table contain already the columns July and August? At the end it should be straight forward aggregations. Lets assume state_ind has the format numberBLANKState Select min(substr(state_ind,1, index(state_ind,' ')),           substr(state_ind,index(state_ind,' ')+1 ) as state,           sum(State_Count ),           max(Total ),           max(case when Month_ = 'July' then State_Count else null end) as July,           max(case when Month_ = 'August' then State_Count else null end) as August From ...                  

Viewing all articles
Browse latest Browse all 27759

Trending Articles



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