Hello, I'm trying to do the SQLite version of the sudoku solver that exist here in POSTGRESQL (here : http://wiki.postgresql.org/wiki/Sudoku_puzzle)
I'm at this stage below currently. could anyone help me ? I have a syntax error , and a bit confuse where it can be (not sure about the modulo translation also) -------------------------------------------------------- drop table if exists gen9; drop table if exists genx; create table genx(x); insert into genx values ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); create table gen9(z); insert into gen9 values (1),(2),(3),(4),(5),(6),(7),(8),(9); WITH RECURSIVE x( s, ind ) AS (SELECT sud, instr( sud, ' ') from (SELECT '53 7 6 195 98 6 8 6 34 8 3 17 2 6 6 28 419 5 8 79' AS sud UNION ALL SELECT substr( s, 1, ind - 1 ) || z || substr( s, ind + 1 ) , instr(substr('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',1, ind) || substr( s, ind + 1 ), ' ' ) FROM x , gen9 as z WHERE ind > 0 AND NOT EXISTS ( SELECT NULL FROM gen9 as lp WHERE z.z = substr( s, ( (ind - 1 ) / 9 ) * 9 + lp, 1 ) OR z.z = substr( s, ind -( ind - 1/ 9 ) - 8 + lp * 9, 1 ) OR z.z = substr( s, (( ind - 1 ) / 3 - ( ( ind - 1 ) / 3 )/ 3 ) * 3 + ( ( ind - 1 ) / 27 ) * 27 + lp + ( ( lp - 1 ) / 3 ) * 6 , 1 ) ) ) SELECT s FROM x WHERE ind = 0; _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users