Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 28 Jul 2009 @ 19:53:29 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Transpose or Pivot data
 
From:   Dieter Noeth

Hi Frank, you're close :-)

     Select location, unit_ID,
        sum(Case When t.fault=3 Then 1 Else 0 End) as Fault3,
        sum(Case When t.fault=35 Then 1 Else 0 End) as Fault35,
        sum(Case When t.fault=155 Then 1 Else 0 End) as Fault155,
        sum(Case When t.fault=156 Then 1 Else 0 End) as Fault156,
      From table
     Where location = 4443
        And unit_ID = 3124
        And fault in  (3, 35, 155, 156)
     Group by location, unit_ID;

Dieter



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023