-->
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: Diesen Query in HQL? Probleme mit Group und Order
PostPosted: Wed Nov 08, 2006 9:37 am 
Newbie

Joined: Wed Nov 08, 2006 8:38 am
Posts: 1
Hallo,

ich bin dabei folgenden SQL Query in HQL umzubasteln doch leider stoß ich immer wieder auf das selbe Problem.

SQL:
select min(price) as price,Date_Format(psm_date,'%d.%m.%Y')as date_form ,products_name from td_prices where product="<id>" and price<products_BAP and product=products_id and DATE_SUB(CURDATE(),INTERVAL 8 day) <= date group by name order by price

HQL:
select min(p.price) as minp ,p.name from Price p where p.idProduct=:listid and p.price<p.productsBap and :datevalid<= p.validTo group by p.name order by minp;


Ohne die Sortierung am ende macht er es ohne Probleme nur möchte ich eigentlich nicht die liste dann nochmal selbstdurchsortieren müssen da ich der Meinung bin dass es ja eigentlich einen weg geben müsste.

Die logs schmeißen mir keine Fehler oder sonstige hinweiße


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 11:29 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Vielleicht geht das:
Code:
select min(p.price) as minp ,p.name from Price p where p.idProduct=:listid and p.price<p.productsBap and :datevalid<= p.validTo group by p.name order by
min(p.price);

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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.