-->
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: Problem with query
PostPosted: Wed Sep 15, 2004 10:49 pm 
Newbie

Joined: Thu Jul 08, 2004 1:10 pm
Posts: 11
Hibernate version: 2.1
Name and version of the database you are using: sql server 2000

Hello, good afternoon. I have a working query written in SQL, and I was wondering how to do something alike with HQL.

Code:
SELECT Recrut
FROM dbo.tVagas v
LEFT OUTER JOIN(
   SELECT IDvaga, COUNT(DataEnvio) AS Recrut, COUNT(DataEncaminhamento) AS Encam
   FROM dbo.tEncaminhamentos enc
   GROUP BY IDvaga
   ) enc ON v.IDvaga = enc.IDvaga
ORDER BY v.IDvaga


Vaga( IDvaga ) 1..* Encaminhamentos( ID, IDvaga )

I tried to make something like this
Code:
SELECT count( enc.DataEnvio ), ...
FROM Vaga v
LEFT OUTER JOIN v.encaminhamentos enc

But them I would have to "order by" every property besides the "count(..)" (about 15).


Thanks for reading.


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.