| Author |
ORA-00979: not a GROUP BY expression
|
Ketan Abdar
Greenhorn
Joined: Jun 13, 2011
Posts: 2
|
|
Getting this error when i run a JPA query on a view , the query is as follows
SELECT t0.qcd, t0.qcnt, t0.qdsc, t0.qsum FROM viewname t0 WHERE ROWNUM <= 20 GROUP BY t0.qcnt, t0.qdsc, t0.qsum, t0.qcd
actually the query runs fine in SQL developer but fails in JPA entity
|
 |
Mike Zal
Ranch Hand
Joined: May 04, 2011
Posts: 144
|
|
|
What happens if you remove the table reference from the column names in the group by clause?
|
OCJP6, OCWCD5
|
 |
Fatih Keles
Ranch Hand
Joined: Sep 01, 2005
Posts: 182
|
|
|
What is the purpose of group by if there is no aggregate function in your select statement? If we replace "viewname" with a table this query will not fail. Can you provide a real sql statement? I suppose there is something within "viewname" (view?)
|
 |
Ketan Abdar
Greenhorn
Joined: Jun 13, 2011
Posts: 2
|
|
no,
i have written a named query in my JPA entity and the query is 'Select o from VStatus o', here Vstatus is the entity in JPA and in DB it is referring a view.
i have tried different forms of query given in previous post to get rid of the error but it always throws this error in logs and the list doesn't get populated,
The view has values in the database, so i dont think there is a problem in the view
|
 |
Mike Zal
Ranch Hand
Joined: May 04, 2011
Posts: 144
|
|
|
I haven't done decent SQL in a while. After looking at Fatih's post I think I might see yhe problem. If you are doing a simple select with no aggregate function, you should be doing an ORDER BY instead of GROUP BY.
|
 |
 |
|
|
subject: ORA-00979: not a GROUP BY expression
|
|
|