Fixes #5223: Query builder now supports selecting sub-queries as columns