UNCMoochie
Programmer
I'm trying to rebuild and reorganize a database table. This table i'm working off of has a column for every year going back to 1973 and the total number of goods purchased by a customer in each column (it's very unorganized). There isn't a customer file and I'm trying to create one with a date joined (or something equivalent).
I tried using case at first B/C I wasn't sure if it worked as an elseif checking each condition even if it had met the first, but that didn't work. i want to do something like below (only what i have below doesn't work) let me know if i'm being unlclear.
Create Table #T1 (Id Int, s98 Int,s99 Int, s00 Int, yr_joined varchar(4))
Insert Into #T1 Values(1, 206,65,11,'')
Insert Into #T1 Values(2, 0,23,11,'')
Insert Into #T1 Values(3, 0,0,11,'')
Insert Into #T1 Values(4, 99,23,11,'')
Insert Into #T1 Values(5, 614,0,11,'')
update #T1 set yr_joined =
case
when s00 > 0 then '2000'
when s99 > 0 'Green' then '1999'
when s98 > 0 not null 3 then '1998'
end
is there a way to make this work similar to an Elseif statement?
I tried using case at first B/C I wasn't sure if it worked as an elseif checking each condition even if it had met the first, but that didn't work. i want to do something like below (only what i have below doesn't work) let me know if i'm being unlclear.
Create Table #T1 (Id Int, s98 Int,s99 Int, s00 Int, yr_joined varchar(4))
Insert Into #T1 Values(1, 206,65,11,'')
Insert Into #T1 Values(2, 0,23,11,'')
Insert Into #T1 Values(3, 0,0,11,'')
Insert Into #T1 Values(4, 99,23,11,'')
Insert Into #T1 Values(5, 614,0,11,'')
update #T1 set yr_joined =
case
when s00 > 0 then '2000'
when s99 > 0 'Green' then '1999'
when s98 > 0 not null 3 then '1998'
end
is there a way to make this work similar to an Elseif statement?