|Re: scalar subqueries in select supported? [message #940146 is a reply to message #939176]
||Thu, 11 October 2012 10:57
| Knut Wannheden
Registered: July 2009
On 10/10/12 3:46 PM, James Sutherland wrote:> EclipseLink 2,4 does
support sub-queries in the SELECT clause in JPQL.
> It should work in criteria as well (ensure you are using 2.4).
I was testing with EclipseLink 2.3. This probably explains why I
sometimes got funny results.
I now see that EclipseLink 2.4 is documented to support scalar
sub-queries (aka "sub-selects") in the SELECT clause:
I had missed that one. But that is very good news!
> Using EXISTS in the SELECT clause I don't think is allowed in the
> database, so this does not sound correct.
> What is your code, and what is the generated SQL?
Some databases which have BOOLEAN datatypes, like e.g. Derby, support
EXISTS in the SELECT clause. E.g.
select id, exists(select 1 from bar b where b.foo_id = f.id) has_bar
from foo f;
Of course that can also easily be expressed differently on other
databases, like Oracle, which don't support EXISTS expressions in the
Powered by FUDForum
. Page generated in 0.02088 seconds