|
Archives of the TeradataForumMessage Posted: Thu, 22 Jan 2004 @ 19:36:11 GMT
You might want to create basically an Identity matrix (table) that you can join to your horizontal table. The output will be a vertical table that can condensed to your desired result. If you can built a State_tbl from your existing data with the following columns State col1 col2 col3 col4 . 48 1 2 7 9 Ident_tbl ca cb cc cd 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 The above case is if you only need to rotate 4 columns (you can extend this method) Select state_code, (ca*col1)+(cb*col2)+(cc*col3)+(cd*col4) From State_tbl, Ident_tbl I've used this technique to normalize repeating groups. Thanks, Phil Edelsberg, CCP, PMP.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||