I've got two queries (actually one of those is a union of two distinct queries but the output is effectively one) that are just lists of id values. I.e. list1 and list2 I want to check whether any of ...
I'm not sure if it's quite what you're asking, but if I understand you correctly, what you want to do, is get the count of items that match your query [ count(id) or something similar ] and then only ...