Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 05 Feb 2005 @ 10:31:39 GMT


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


Subj:   SQL Case statement help needed.
 
From:   mark barlow

I am relatively new SQl coder and am struggling to get to grips with the syntax of case statements.

In the code below the place the code falls over on is or (a.code = c.code), I would be grateful if someonce could point out where I am going wrong please?

     insert into table_1
     select
     b.id,
     brand,
     case when (substr(offer,1,5) between 'G100' and 'G816' )
      or (offer not like 'G%' and substr (band,1,1) = 'T')
      or (a.code = c.code) then 1
             else 0
     end,
     case when (substr(offer,1,5) not between 'G100' and 'G816')
      and substr (band,1,1) ne 'T'
      and (a.code ne c.code) then 1
             else 0
     end
     from table_4 a,
     table_5 b,
     table_6 c
     where a.id = b.id
     and date >= date '2004-01-31'
     group by 1,2,3,4
     ;


     
  <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