-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to sum of a numberic field result of distinct query
PostPosted: Mon Jun 22, 2009 7:13 am 
Newbie

Joined: Mon Jun 22, 2009 6:25 am
Posts: 1
Hi

I want to write a hql ( query in hibernate ) , My problem is that in my one query the result of that query is come using distinct , not i want to sum of one field carried out from that distinct query but it also distinct in sum method too.

Can i use sub table in hql e.g inner join (select * from ....). ?

So how can i solve this .


Top
 Profile  
 
 Post subject: Re: How to sum of a numberic field result of distinct query
PostPosted: Mon Jun 22, 2009 7:53 am 
Newbie

Joined: Fri Dec 14, 2007 8:44 am
Posts: 10
Hi,

Instead of using DISTINCT,
u can solve your problem with Group By clause aand Aggregate function.


Like ,
select <<sum(salary)>> from <<emp>>
group by <<Grade>>


Hope this help you !!


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

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.