So I created a new column through the following script below. I now want to insert values binary values into the created column whether of if cust_id is within (1) or outside (0). I’m have tried to left join to get the table for cust_id that should have 1 and then give the rest 0. When I’m trying to run it I get the following error: ORA-00933: SQL command not properly ended . Does anyone know what I can do to solve this?
ALTER TABLE
JWxsellallprod
ADD
previous_year_flag number;
update JWxsellallprod t1
set t1.played_previous_year = case when t2.cust_id IS NOT NULL then 1 else 0 end
from JWxsellallprod t1
left join
(select a.Year_of_Play, a.Year_Aquired, a.cust_id
from JWxsellallprod a
inner join JWxsellallprod b
on b.cust_id = a.cust_id
where
a.player_days > 0
and
b.player_days > 0
and
b.Year_of_Play = a.Year_of_Play - 1
and
a.Year_Aquired = b.Year_Aquired) t2
on t2.cust_id = t1.cust_id
and t2.Year_of_Play = t1.Year_of_Play
and t2.Year_Acquired = t1.Year_Acquired
Thanks
Jesper