Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 09 Sep 2004 @ 11:01:27 GMT


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


Subj:   Re: SQL puzzle...
 
From:   Subramanian, Suresh

Hope this helps

     sel * from bla1 a
     inner join
     bla2 b
     on (a.bdf=b.bdf
     and a.sai=b.sai
     and a.ek_akt=b.ek_akt
     and
     a.genre=b.genre
     )

     union

     sel * from bla1 a
     left join
     bla2 b
     on a.bdf=b.bdf
     and a.sai=b.sai
     and a.ek_akt=b.ek_akt
     and
     0=b.genre
     where a.genre  not in ( sel a.genre from bla1 a
     inner join
     bla2 b
     on (a.bdf=b.bdf
     and a.sai=b.sai
     and a.ek_akt=b.ek_akt
     and
     a.genre=b.genre
     )
     )

     union

     sel * from bla1 a
     left join
     bla2 b
     on a.bdf=b.bdf
     and a.sai=b.sai
     and a.ek_akt=b.ek_akt
     and
     0=b.genre
     where a.genre is null

Cheers

Suresh



     
  <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