-->
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: arithmetic on scalar subselects
PostPosted: Thu Mar 11, 2010 4:55 pm 
Newbie

Joined: Thu Oct 08, 2009 9:07 pm
Posts: 1
How can one do arithmetic on scalar resultsets in hql? Consider a 1:n parent->child relationship:

select
(select count(*) from Child where parent = p)
from Parent p

works just fine.

select
1 + (select count(*) from Child where parent = p)
from Parent p

doesn't. This type of thing is valid in sql. Is there a way to achieve this or have I missed something? And don't put the '1' in the subselect, you crafty little cur. What I really want to do is add the results of two moderately complex subselects.


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.