Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 08 Oct 2013 @ 13:56:36 GMT


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


Subj:   Record count mismatch
 
From:   Jepamony, Johnpaul

Hi,

Could some one help me in correcting the simple Join issue.

I have two table A and Table B which is a header and detail table.

     SEL COUNT(*) FROM DB.TBL1;
     RECORD COUNT---5

     SEL COUNT(*) FROM DB.TBL2;
     RECORD COUNT ---6

Now i'm inner joining two tables on key columns and selecting the count

     SELECT COUNT (*)
     FROM
     DB.TBL1 TBL1
     INNER JOIN?
     DB.TBL2 TBL2
     ON
     TBL1.KEY_1 = TBL2.KEY_1
     AND
     TBL1.KEY_2 = TBL2.KEY_2;
     RECORD COUNT ---6

Why I'm getting record count as 6, Ideally I should get table A count 5 since I'm doing inner join.

I tried with Select Distinct(COUNT (*)) and Select COUNT(1) but it gives me the same record count as 6.

Where I?m doing the mistake?



     
  <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