These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HQL: GROUP BY
PostPosted: Fri Mar 18, 2005 5:56 am 
Beginner
Beginner

Joined: Thu Dec 16, 2004 11:54 am
Posts: 26
Location: Brussels, Belgium
I'm trying to run this query:

Code:
"select distinct p, count(ol) " +
"from Order d " +
"join d.lines ol " +
"join ol.referenceProduct p " +
"join p.options o " +
"join p.catalogs c " +
"join p.parentBrand b " +
"where o.stockAvailable > 0 " +
"and d.creationDate > :date " +
filter +
"group by p.id, p.regularPrice, p.reference, p.buyPrice, " +
"p.creationDate, p.lastModification, p.bargain, p.referenceNumber,  "  + "p.promoPrice, p.stockAvailable, p.imageUsed, p.parentBrand.id " +
"order by count(ol) desc";


Since I have to "group by" by hand, but I just can't find how to group by p.id_brand (many-to-one to Brand)....
Can some one give me an hint?
p.parentBrand.id doesn't work, neither did p.parentBrand.
Thanks
Alex


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.