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 je...@optonline.net on 2005/02/03 02:12:46 UTC

HAVING BY? question about how to form a PB query

I am trying to implement this query using the PB:

SELECT regionid AS r, COUNT(regionid) AS r_cnt
              FROM jps1
              WHERE (countryid="US")
              GROUP BY regionid
              HAVING (r_cnt > 1);

In general I am trying to get list of regions and the number of regions by country.

It wuold be good to be able to associate the regionId to another table which has the name, but I can deal with that myself.

I have some experience with OJB, but I am not seeing how to do this without using a query by sql.   I would prefer not to do that.   Any ideas?

Thanks for any help.

JohnE



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


Re: HAVING BY? question about how to form a PB query

Posted by Carlos Chávez <cc...@agssa.net>.
jeichels@optonline.net Escribio :-)
>
> I am trying to implement this query using the PB:
>
> SELECT regionid AS r, COUNT(regionid) AS r_cnt
>               FROM jps1
>               WHERE (countryid="US")
>               GROUP BY regionid
>               HAVING (r_cnt > 1);
>

 Hi JohnE,

 Well, We can specify a HAVING criteria in a ReportQueryByCriteria.
 for example:

 ...
 ReportQueryByCriteria query = new ReportQueryByCriteria(...);
 ...
 query.setHavingCriteria(specify the criteria);
 ...
 ...


 Cheers.
 Carlos Chávez.

> In general I am trying to get list of regions and the number of regions by
> country.
>
> It wuold be good to be able to associate the regionId to another table
> which has the name, but I can deal with that myself.
>
> I have some experience with OJB, but I am not seeing how to do this
> without using a query by sql.   I would prefer not to do that.   Any
> ideas?
>
> Thanks for any help.
>
> JohnE
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>


-- 
Carlos Chávez

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