> On Jan 9, 2017, at 4:45 AM, Nikita Timofeev <ntimof...@objectstyle.com> wrote: > >> >> Finally, 'having()' matches the SQL (HAVING is needed for queries on the >> result of functions). Have you thought about how that could be abstracted >> away so that the user can use where() and the correct SQL is still generated >> by Cayenne? >> > > I can't prove but I think there are some cases when the final result > depends on whether you use where() or having() on column.
Yes, "having" and "where" are 2 distinct filters. The former filters data before *aggregation*, the later - after. Aggregation functions operate on the result filtered with "where". No matter what API we ultimately provide, this distinction is unavoidable, and I'd rather we keep it explicit. Andrus