Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 02 Jan 2009 @ 14:32:03 GMT


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


Subj:   Re: IN clause limt
 
From:   Joerg Mutsch

Hi Shijo,

it's not elegant but this should work

     select sum(counts) total_number from
     (
     select column1, count (*) as counts from tablename1
     inner join
     (select
     column1 from tablename2 where condition
     group by 1) as tablename2
     on tablename1.column1 = tablename2.column1
     group by 1
     ) tablename3

Note: the group by in the derived table is related for avoiding double countings (in case you have)

Hope this helps.


Regards

Joerg



     
  <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