-->
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: Retrieve record with latest date field?
PostPosted: Tue Apr 10, 2007 10:17 am 
Regular
Regular

Joined: Tue Apr 10, 2007 10:02 am
Posts: 56
In HQL how do I create a query that retrieves a record with the latest date field?

In SQL this would be something like...
Code:
select * from Invoice where InvoiceDate = (select MAX(InvoiceDate) from Invoice)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 10:39 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Code:
from Invoice i where i.invoiceDate = (select max(subi.invoiceDate) from Invoice as subi)


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.