1 Reply Latest reply on Dec 5, 2001 8:27 PM by David Jencks

    Query with HAVING and GROUP BY and COUNT(*)

    Rachel Cox Newbie

      I'd like to do a query that looks like this

      select count(*) blah from tablename group by id having blah > 0

      is there a way to do this is jaws.xml?


        • 1. Re: Query with HAVING and GROUP BY and COUNT(*)
          David Jencks Master

          The queries in jaws.xml are only to find the pks for entity beans... so if you got what you asked for, the count(*) would have to be the pk for some table. Is this really what you want? (also then the group by is not legal sql)

          If you actually want the results from the query you wrote (+ id in select clause), you can execute sql directly from a session bean and put it into (non ejb) objects yourself.

          If you want ejb's containing id (pk) and count(*), I suggest you create a view based on your query and use an autogenerated query against the view.