a8n Store: Use sub-select instead of CTE to address performance concern
Created by: mrnugget
This addresses the possible performance concerns mentioned by @felixfbecker in this comment:
https://github.com/sourcegraph/sourcegraph/pull/7036#discussion_r355012549