my sqlite database has 2 columns named child , parent , element value 0 root of tree , sample data:
child parent 33 16 16 0 45 39 30 0 i trying write sqlite query determine number of trees & path shown below number of trees : 2
0 16 33 0 30 49 i able find out rows 0s ...but not able think of logic generate path..
any suggestions please
how many children can have parent? in example, seem assume each 'root' parent has 1 child. maybe start like:
select a.parent, a.child, b.child mytable join mytable b on a.child = b.parent a.parent = 0; (not tried). should more precise in question.
if interested number of trees, maybe like:
select count(*) mytable parent = 0; best regards.
Comments
Post a Comment