-->
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: Need Help in Query inside another Query
PostPosted: Fri Jul 20, 2007 1:01 am 
Newbie

Joined: Fri Jul 20, 2007 12:30 am
Posts: 3
Hi All,

I have a following query How can i do:

select tckno from issues where id=(select max(id) from issues);

Do I need to Write the Query Twice like first for

1. selecting the max(id). Then
2. Selecting the tckno.


Or How can I do it at once. Also How Can I use the functions in Hibernate like : between, in, max, count etc.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 2:06 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

use sqlquery

session.createSQLQuery("select i.tckno from issues i where i.id=(select max(id) from issues)");

for more detail chapter 14.14. HQL examples

Amila

(Dont't forget to rate if helps)


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.