第一句改成:
select
t.nukifuryoc_1 a ,
t.nukifuryoc_2 b ,
(case
when t.nukifuryoc_2 is not null
then decode(substr (t.nukifuryoc_2,1,1),'1','1','2','2','3','3','4')
when t.nukifuryoc_2 is null
then (case
when t.nukifuryoc_1 is not null
then decode(substr(t.nukifuryoc_1,1,1),'1','1','2','2','3','3','4')
when t.nukifuryoc_2 is null
then '0'
end)
end) nuki
from
nyukentorihiki t
Group By
t.nukifuryoc_1,t.nukifuryoc_2
select
t.nukifuryoc_1 a ,
t.nukifuryoc_2 b ,
(case
when t.nukifuryoc_2 is not null
then decode(substr (t.nukifuryoc_2,1,1),'1','1','2','2','3','3','4')
when t.nukifuryoc_2 is null
then (case
when t.nukifuryoc_1 is not null
then decode(substr(t.nukifuryoc_1,1,1),'1','1','2','2','3','3','4')
when t.nukifuryoc_2 is null
then '0'
end)
end) nuki
from
nyukentorihiki t
Group By
t.nukifuryoc_1,t.nukifuryoc_2
t.nukifuryoc_1 a ,
t.nukifuryoc_2 b ,
(case
when t.nukifuryoc_2 is not null
then decode(substr (t.nukifuryoc_2,1,1),'1','1','2','2','3','3','4')
when t.nukifuryoc_2 is null
then (case
when t.nukifuryoc_1 is not null
then decode(substr(t.nukifuryoc_1,1,1),'1','1','2','2','3','3','4')
when t.nukifuryoc_2 is null
then '0'
end)
end) nuki
from
nyukentorihiki t
Group By
t.nukifuryoc_1,t.nukifuryoc_2