Fix unsupported usage of nested select queries.