I'd like to explain to you how has to look the complete statement:
Code:
with <-- start of pt1 -->
all_nbrs (k, search_no) as
(
select 1, varchar('1', 1)
from sysibm.sysdummy1
union all
select k + 1, varchar(k + 1)
from all_nbrs
where k + 1 <= 9 )
,
Source (line, sudoku_str) as
(
select 1, '000000000'
from sysibm.sysdummy1
union all
select 2, '070006030'
from sysibm.sysdummy1
union all
select 3, '030720040'
from sysibm.sysdummy1
union all
select 4, '700008001'
from sysibm.sysdummy1
union all
select 5, '600307005'
from sysibm.sysdummy1
union all
select 6, '509100000'
from sysibm.sysdummy1
union all
select 7, '080091020'
from sysibm.sysdummy1
union all
select 8, '091600070'
from sysibm.sysdummy1
union all
select 9, '000000000'
from sysibm.sysdummy1
)
...
...
...
(select cand S from SudokuSt2 where i = 2 and j = 8
and cand not in (s21.s, s22.s, s23.s, s24.s, s25.s, s26.s, s27.s)
and cand not in (s17, s18, s19)
) s28, table
(select cand S from SudokuSt2 where i = 2 and j = 9
and cand not in (s21.s, s22.s, s23.s, s24.s, s25.s, s26.s, s27.s, s28.s)
and cand not in (s17, s18, s19)
) s29
) SL2 <-- end of pt1 -->
, Table <-- start of pt2 -->
(
select s31.s S31, s32.s S32, s33.s S33, s34.s S34, s35.s S35, s36.s S36, s37.s S37, s38.s S38, s39.s S39
From table
(select cand S from SudokuSt2 where i = 3 and j = 1
and cand not in (s11, s12, s13, s21, s22, s23)
and cand not in (s11, s21)
) s31, table
(select cand S from SudokuSt2 where i = 3 and j = 2
and cand not in (s31.s)
and cand not in (s11, s12, s13, s21, s22, s23)
...
...
...
Union All
select Line_8 as "Sudoku Line", Weight from Sudoku_Final
where Line_8 > ' '
Union All
select Line_9 as "Sudoku Line", Weight from Sudoku_Final
where Line_9 > ' ' ) tt
group by tt."Sudoku Line", Weight
order by Weight, "Sudoku Line" <-- end of pt2 and complete -->
How you understand comments I added just for better understanding and you will not find them in the attachments.
Thanks, Lenny Khiger ADSPA&VP