Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 21 Feb 2008 @ 12:58:34 GMT


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


Subj:   Re: 3637 error message seems inconsistent
 
From:   Fabio de Lucca

I just would like to add some comments to what Michael said:

I do not consider a good practice the use of column numbers in clauses like "GROUP BY" and "ORDER BY" to substitute the columns name, although it works perfectly, for a simple reason: if you add a new column in the column list, and forget to change the column number in the above clauses (ORDER or GROUP), you may have to spend unnecessarily time to debug your query.

I normally use the column name instead, what causes me more efforts when typing, but saves me from headaches in the future.

Try the following and see if it helps you:

     select
          'Oct 2002 - Sep 2003' as col1,
          0,
          srvcctgryinf.m_svc_cat_cd_desc as col3,
          sum(f.chg_allow_amt),
          sum(f.mdst_qty_svcs_cnt),
          count(distinct f.person_prov_date)
     from svc_cat as srvcctgryinf,
            epi_prof_clm as f,
            clm_general as claimgeneral
     where claimgeneral.mdst_claim_type_cd = 1
         and f.claim_general_key = claimgeneral.claim_general_key
         and f.svc_cat_key = srvcctgryinf.svc_cat_key
         and f.period_inc_key between 8310 and 8674
     group by 1, srvcctgryinf.m_svc_cat_cd_desc, srvcctgryinf.m_svc_cat_cd_desc
     order by col1 asc, col3 asc ;

Good luck!

Fabio



     
  <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