-->
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: Count including zero
PostPosted: Thu Jul 10, 2008 7:15 am 
Newbie

Joined: Thu Jul 10, 2008 6:59 am
Posts: 1
Location: Dubai, U.A.E
Hi,

I'm new to HQL.

I just want to ask if for example i have this 2 tables

IP | Subnet
-------------------------------
192.168.1.1 | 192.168.1.0
192.168.1.2 | 192.168.1.0
192.168.1.3 | 192.168.1.0


Subnet IP | Subnet Name
--------------------------------
192.168.1.0 | Main Subnet
176.26.2.1 | testsubnet
172.56.3.1 | Lab_subnet

I want to count the number of IP in all the subnet and the output should be this

Subnet IP | Subnet Name | IP Count
-----------------------------------------------
192.168.1.0 | Main Subnet | 3
176.26.2.1 | testsubnet | 0
172.56.3.1 | Lab_subnet | 0

But the problem is that it only shows:

Subnet IP | Subnet Name | IP Count
-----------------------------------------------
192.168.1.0 | Main Subnet | 3

I want to show the row with 0(zero) result.

Please help. Thank you in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 10:48 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Could we see your code that produces this? Are you doing a unqiue result query, or querying for a collection to be returned?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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.