Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Derived Queries

Not sure I understand, why not just use,

"Select count(object) from table object"

Perhaps include the code for the query you tried, and the SQL/error you got.



Jeremiah Johnson-7 wrote:
> 
> I'm trying to write a JPQL Query that counts the number of records in
> a set. I tried using a ReportQuery (with the origional JPQL) but that
> has problems if the JPQL query is already returning results. The
> ReportQuery tries to add the count to the results list which causes an
> sql error because the other results in the origional query are not
> grouped. I think I need to have something like:
> 
> select count (obj) from (select obj2 from table obj2) obj
> 
> But that does not work. Is there a way I can suppress the columns in
> the ReportQuery (made from a JPQL query) that are not grouped or  is
> there some way to make the JPQL above work?
> 
> -- 
> Jeremiah Johnson
> Kunz Leigh & Associates
> Phone: 517-488-7393
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Derived-Queries-tp24972566p25062302.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top