join NODES table to subquery results if necessary