-->
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: "select top 1" ... in a subquery ... is it possible?
PostPosted: Tue May 19, 2009 12:38 am 
Newbie

Joined: Mon Aug 22, 2005 7:11 pm
Posts: 13
I'm going crazy trying to figure out how to do this:
var annualCount = Convert.ToInt32(
Session.CreateQuery(@"
select count(*) from Activity ta
where ta.Budget = (select top 1 b from ta.Division.Budgets b
where b.ApprovalStatus.Id = 0 order by b.StartDate)"
).UniqueResult());

Is there a way to accomplish this? I'm up for doing it via ICriteria
as well if that works.
thanks


Top
 Profile  
 
 Post subject: Re: "select top 1" ... in a subquery ... is it possible?
PostPosted: Mon May 25, 2009 9:09 am 
Hi there.

I think you can use IProjection to solve your problem.
Take a look at nhibernate reference.


Top
  
 
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.