sea-query
sea-query copied to clipboard
Support `EXISTS (subquery)` operator
Hi, I'm trying to do simple query and use EXISTS (subquery) operator, but it looks it's not supported yet in sea-query.
.e.g:
select exists(select 1 from accounts where email = $1 limit 1) as "exists!"
I think it can be done like
Query::select().expr(Expr::cust("COUNT(*) AS count")).from_subquery(...);
Yeah that's work too, but I'm not sure about the query performance count() vs `exists(). I'm no expert in query performance things.
And I think we should have exists() sooner or later.
+1 on having exists()
I will look at the issue
Hello! I create PR: https://github.com/SeaQL/sea-query/issues/118.