Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 02 May 2006 @ 12:16:59 GMT


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


Subj:   Re: Need Help Writing SQL
 
From:   Cappelli, Andrea

I don't know if my suggest yield the needed result, but sure not you're saying...

As you can see I take col3 as col4 in the case I have an unique value for col1 and not the count (distinct).

Is it right????

     select a.col1
     ,a.col2
     ,a.col3
     ,case when (dist_val)=1 then col3
     else 8
     end
     from tabA a
     inner join
     (select col1,count(distinct col3) as dist_val
     from tabA
     group by 1) b
     on a.col1=b.col1
     ;

Andrea Cappelli
NCR Italia
Teradata Professional Services
Teradata Certified Implementation Specialist V2R5



     
  <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