You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Mike Young <mi...@e-mage.com.au> on 2004/09/05 11:46:14 UTC

SubQueries to create SQL Having clauses & Group Functions

Hi All I am really struggling with subqueries and report queries. I have
the following table (EmpCourse):

EmpId CourseId    Expires
===== ========    =======
1     ST1   	  01/06/03
1     ST2         {null}
1     ST1   	  01/06/04
1     ST1   	  01/06/05
2     ST1         01/11/04

and I want to build an ojb 'query' using the persistance broker and
queryByCriteria that will replicate the following SQL query

select EMPID,COURSEID,EXPIRES
from EMPCOURSE
where EMPID = '1'
group by EMPID,COURSEID,EXPIRES
having (max(EXPIRES) >= SYSDATE) or (max(EXPIRES) is null);

Can anybody please help me?


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org