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.  [ 3 posts ] 
Author Message
 Post subject: [HQL]count and distinct on multiple columns
PostPosted: Wed May 06, 2009 4:45 am 
Newbie

Joined: Wed May 06, 2009 4:41 am
Posts: 2
Hi,

on SQL i can do sth like
SELECT COUNT (*) FROM (SELECT DISTINCT column1, column2 FROM table1)
to get the number of results for a distinct query. On HQL it is not allowed to
use subqueries in the from-clause.
I there any way i can "decorate" my query with a count or use distinct and count at the same
time on multiple columns without getting all the data from the database to my client

Dennis


Top
 Profile  
 
 Post subject: Re: [HQL]count and distinct on multiple columns
PostPosted: Thu May 07, 2009 2:44 am 
Newbie

Joined: Wed May 06, 2009 4:41 am
Posts: 2
Anyone an idea ?


Top
 Profile  
 
 Post subject: Re: [HQL]count and distinct on multiple columns
PostPosted: Fri May 08, 2009 2:29 pm 
Senior
Senior

Joined: Thu Jan 08, 2009 3:48 pm
Posts: 168
SELECT count(DISTINCT column1, column2) FROM table1

didn't try it but could work

Patrik


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.