> Is it possible to refine/combine the above two sets of queries into one?
Yes. It's possible: A) SELECT e.to_node_id AS node_id FROM edge e WHERE e.from_node_id = $node_id UNION SELECT e.from_node_id AS node_id FROM edge e WHERE e.to_node_id = $node_id B) SELECT count(edge_id) FROM edge WHERE edge.to_node_id IN (Query_A) OR edge.from_node_id IN (Query_A) _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users