|  |  | 
|  |  | Archives of the TeradataForumMessage Posted: Fri, 24 Jun 2005 @ 22:13:04 GMT
 
 Single pass with group by to pivot rows.... 
     Select  a.cust,
             Sum(case when a.acct = 100 then a.bal else 0 end) as bal_100,
             Sum(case when a.acct = 200 then a.bal else 0 end) as bal_200,
             Sum(case when a.acct = 300 then a.bal else 0 end) as bal_300
     From tbl1 a
     Group by 1
Kyle Prescott 
 | ||||||||||||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||||||||||||||||||||
|   | ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||