Archives of the TeradataForum
Message Posted: Sat, 05 Feb 2005 @ 10:31:39 GMT
| 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
insert into table_1
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
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
from table_4 a,
where a.id = b.id
and date >= date '2004-01-31'
group by 1,2,3,4