Understanding Having Criteria

You can have where (simple) criteria or having criteria in a query. In most cases, you have a WHERE clause only—that is, simple criteria. Having criteria is only used in some special cases of aggregation queries. They represent the HAVING clause of the SQL statement, similar to the following:



group by A.DEPTID

having COUNT(A.EMPLID)>5

Having criteria are separated from simple criteria. They're accessed as follows:

  • Having criteria are accessed using either the AddHavingCriteria QuerySelect method or HavingCriteria QuerySelect property

  • Simple criteria are accessed using either the AddCriteria QuerySelect method or the Criteria QuerySelect property.

  • However, the having criteria and the simple criteria have all the same methods and properties, so in this documentation, they're described together under the heading QueryCriteria.