-->
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: problem when calculate query recordCount
PostPosted: Mon May 18, 2009 4:55 am 
Newbie

Joined: Mon May 18, 2009 4:51 am
Posts: 7
Hi,
I need to calculate the query recordCount of the following query:

SELECT FIELD, FIELD1 , count(FIELD2)
FROM TABLE
WHERE FIELD IS NOT NULL
GROUP BY FIELD, FIELD1
ORDER BY FIELD, FIELD1

How can I do this using HQL ?


Top
 Profile  
 
 Post subject: Re: problem when calculate query recordCount
PostPosted: Mon May 18, 2009 7:30 am 
Newbie

Joined: Thu Jan 15, 2009 9:54 am
Posts: 12
suppose you have mapped your Table1 with Employee Class.
private String deptName;
private String managerName;
private String empName;

now your HQL query will be as follows.

select e.deptName, e.managerName, count(e.empName)
from Employee e
where e.deptName is not null
group by e.deptName, e.managerName
order by e.deptName, e.managerName

hope it helps

Abid


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.