-->
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: Help with HQL query
PostPosted: Sat May 01, 2010 11:14 pm 
Newbie

Joined: Mon Apr 19, 2010 1:15 pm
Posts: 1
Hey all-

I'm not the greatest with SQL statements and this is my first endeavor into hibernate and HQL so I'm having some issues. Can somebody help fix this attempt at an HQL query?

Code:
select p1 from Product as p1 left outer join Product p2
with p1.timestamp<p2.timestamp and p1.id=p2.id
where isNull(p2)


The idea is to grab the most recent "version" of a each kind of product in the table. I think an outer join on the timestamp column where p1 are more recent than p2, then finding rows where is no p2 value because there are none more recent than p1. I hope that makes sense. Thanks in advance.


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.