"Emilio Platzer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I want to UPDATE a field of one table with data of rows of the same > table. > > For example to calculate the depth of a node in a tree > > update nodes as s set s.depth= > (select f.depth+1 > from nodes as f > where f.id=s.father_id) > where s.depth is null;
You can't give an alias to the table you are updating, but you can use the same table (with an alias) in subselect. Just make it update nodes set s.depth= (select f.depth+1 from nodes as f where f.id = father_id) where depth is null; Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users