Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sun, 17 Jul 2005 @ 09:12:51 GMT


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


Subj:   Why do these queries produce different results.
 
From:   Anomy Anom

<-- Anonymously Posted: Friday, July 15, 2005 01:28 -->

The two queries below are identical except for the order of the views in the from clause.

They do not however produce identical results. They are out by a factor of 1000. This to me just seems plain wrong. The order of the tables in the from cause should change the result set, should it? Any ideas why it would?

     Select da.re_id ,
            dw.draw_per_id ,
            dg.draw_ga_id ,
            Sum(dss.sell_amo)
     From DLOT_VMDB.DIM_REGION re,
          DLOT_VMDB.DIM_DRAW dw,
          DLOT_VMDB.DIM_DRAW_GAME dg,
          DLOT_VMDB.F_DRAW_SALES_SUMMARY dss,
          DLOT_VMDB.DIM_AGENT da
     Where re.re_n IN 'VICTORIA'
       And dw.draw_per_id In (455)
       And dg.draw_ga_id In (3)
       And re.re_id = da.re_id
       And dss.re_id = da.re_id
       And dss.ag_id = da.ag_id
       And dg.draw_ga_id = dw.ga_id
       And dss.draw_ga_id = dw.ga_id
       And dss.draw_per_id = dw.draw_per_id
     Group By da.re_id, dw.draw_per_id, dg.draw_ga_id;




     Select da.re_id ,
            dw.draw_per_id ,
            dg.draw_ga_id ,
            Sum(dss.sell_amo)
     From DLOT_VMDB.DIM_REGION re,
          DLOT_VMDB.DIM_AGENT da,
          DLOT_VMDB.DIM_DRAW dw,
          DLOT_VMDB.DIM_DRAW_GAME dg,
          DLOT_VMDB.F_DRAW_SALES_SUMMARY dss
     Where re.re_n IN 'VICTORIA'
       And dw.draw_per_id In (455)
       And dg.draw_ga_id In (3)
       And re.re_id = da.re_id
       And dss.re_id = da.re_id
       And dss.ag_id = da.ag_id
       And dg.draw_ga_id = dw.ga_id
       And dss.draw_ga_id = dw.ga_id
       And dss.draw_per_id = dw.draw_per_id
     Group By da.re_id, dw.draw_per_id, dg.draw_ga_id;


     
  <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