Fix for multiple results from subquery

If the table name is the same between multiple schemas, multiple
results get returned from the subquery which causes the query to fail.