About GROUP BY

1-10 of 200Refresh
Manual
434

GROUP BY and HAVING clauses

The GROUP BY clause enables grouping of query results. A JPQL query with a GROUP BY clause returns properties of generated groups instead of individual objects and fields. The position of a GROUP BY ... clause. When a GROUP BY clause exists in a JPQL query, database objects (or tuples of database objects
Manual
190

ORDER BY clause (JPQL / Criteria API)

expression: SELECT c.name FROM Country c ORDER BY c.name DESC Grouping (GROUP BY) Order The ORDER BY ... and a GROUP BY clause the SELECT clause receives groups rather than individual objects and ORDER BY ... WHERE 'Europe' MEMBER OF c.continents GROUP BY c.currency HAVING COUNT(c) > 1 ORDER BY c.currency
Manual
76

Chapter 4 - JPA Queries (JPQL / Criteria)

(and a criteria query) is explained by describing the main clauses of JPQL queries (SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY): Then the expressions that are used for building JPQL and criteria query
JDO Doc
67

setGrouping(group)

Method javax.jdo.Query void setGrouping(   String group ) Set the grouping expressions, optionally including a "having" clause. When grouping is specified, each result expression must either be an expression contained in the grouping, or an aggregate evaluated once per group. Parameters: group
Forum
37

Grouping by date()

have to group by date(). For few queries I was concatenating 'date' from year()-month()-day() calls ... implementation. There is only one small problem with new version. When you group by date() there are two days per day. I mean group by divides each day for two parts. You can see an example in attached
Forum
37

Group by date / time

Hi, I'm trying to create reporting query that will return entities grouped by year / mont / day ... stats WHERE YEAR(record_date) = 2009 GROUP BY YEAR(record_date), MONTH(record_date) or maybe something like this: SELECT COUNT(id) FROM stats WHERE YEAR(record_date) = 2009 GROUP BY DATE
Forum
36

Group by: list if no aggregate function is specified

Hello! In a query like SELECT parent, children FROM Parent parent LEFT JOIN p.children children GROUP BY parent maybe it would be good if it will return a list of Object[2], where the second object is a list of children of a parent. Because creating a query to get a list of parents, then fetching
JPA Doc
33

groupBy(grouping)

grouping ) Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. Parameters: grouping - list of zero or
JPA Doc
33

groupBy(grouping)

Method javax.persistence.criteria.AbstractQuery AbstractQuery groupBy(   Expression... grouping ) Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously
JPA Doc
33

groupBy(grouping)

Method javax.persistence.criteria.AbstractQuery AbstractQuery groupBy(   List grouping ) Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added