Steve writes "I've inherited a hierarchy modelled as an adjacency table. This stores a tree, and then stores documents linked to the nodes of that tree.----tree table----------- id label parentid 100 blah 0 101 blah 100 102 blah 101 etc
And with that, what I thought would be simple is stumping me:How do I get a list of all nodes that do not have further children? Eg for the above table, how do I return just 101 and 102?
I can find the nodes that have children quite easily:
select id, label from tree where id in (select parentid from tree) order by label
But when I reverse it ("where id not in") the query almost grinds to a halt. Any faster way to find this list
tia
Steve"