Fix toQuery() on subquery column