shedar commented on issue #28081:
URL: https://github.com/apache/doris/issues/28081#issuecomment-1846271114
@LemonLiTree thank you for the quick reply, tried with 2.0.3-rc05 -
exists+having works as intended.
But exists behaviour still seems odd. Using the same tables:
```sql
select t1.id from t1
where
exists(select 1 from t2 where t1.id = t2.t1_id and t2.id=5) and
exists(select 1 from t2 where t1.id = t2.t1_id and t2.id=6);
-- OK: returns 5
-- now try to invert the condition
select t1.id from t1
where
not (
exists(select 1 from t2 where t1.id = t2.t1_id and t2.id = 5) and
exists(select 1 from t2 where t1.id = t2.t1_id and t2.id = 6)
);
-- BUG: no rows, expected 1,2,3,4,6
-- if I open parentheses using de Morgans' laws, it works:
select t1.id from t1
where
not exists(select 1 from t2 where t1.id = t2.t1_id and t2.id = 5) or
not exists(select 1 from t2 where t1.id = t2.t1_id and t2.id = 6);
-- OK: 1,2,3,4,6
```
Should I create a separate issue for it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]