"Emilio Platzer" <[EMAIL PROTECTED]> wrote
in message
news:[EMAIL PROTECTED]
> I try (and not works):
>
> CREATE TABLE nodes(
>  id integer primary key,
>  father_id integer,
>  depth integer);
> INSERT INTO nodes (id,father_id,depth) VALUES (9,null,1);
> INSERT INTO nodes (id,father_id,depth) VALUES (99,9,null);
> update nodes set depth=
>    (select f.depth+1
>       from nodes as f
>       where f.id = father_id)
>  where depth is null;
> SELECT * FROM nodes;

Make it

update nodes set depth=
    (select f.depth+1
       from nodes as f
       where f.id = nodes.father_id)
  where depth is null;

This time I actually tested it. It works.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to