with WorkView as (
select Row_Number() over (order by a,b,c,d,e) as TID,a,b,c,d,e
from (select 200 as a from dual union all select 0 from dual),
(select 500 as b from dual union all select 0 from dual),
(select 600 as c from dual union all select 0 from dual),
(select 400 as d from dual union all select 0 from dual),
(select 800 as e from dual union all select 0 from dual))
select TID,1 as ID,'りんご' as 品物,a as 金額,a+b+c+d+e as 合計金額 from WorkView
where a+b+c+d+e < 2000 and a!=0
union all select TID,2,'みかん',b,a+b+c+d+e from WorkView where a+b+c+d+e < 2000 and b!=0
union all select TID,3,'もも' ,c,a+b+c+d+e from WorkView where a+b+c+d+e < 2000 and c!=0
union all select TID,4,'かき' ,d,a+b+c+d+e from WorkView where a+b+c+d+e < 2000 and d!=0
union all select TID,5,'いちご',e,a+b+c+d+e from WorkView where a+b+c+d+e < 2000 and e!=0
union all select TID,0,'果物を一つも選択しない',0,0 from WorkView where a+b+c+d+e=0
order by 1,2;