Reputation: 367
I have a query that worked for me when I was using Mysql. Now I get this error on Oracle :
ORA-00979: not a GROUP BY expression
This is the query:
SELECT o.neNesId, COUNT(o)
FROM ParNe AS o
WHERE o.neBanId = :neBanId
GROUP BY o.neNesId
Any ideas why I have this error?
Upvotes: 0
Views: 1085
Reputation: 5782
You need to select count(*) or count(1) as in Gordon's example. If you insist on using your query syntax, which is not necessary at all then try this:
SELECT neNesId, count(o) AS o_cnt
FROM
( -- your query here --
SELECT 1 neNesId, 2 AS o FROM dual
)
GROUP BY neNesId
/
Upvotes: 0
Reputation: 1269543
Your query is:
SELECT o.neNesId, COUNT(o)
FROM ParNe AS o
WHERE o.neBanId = :neBanId
GROUP BY o.neNesId
My guess is that o.o
is not a valid field. So, you have a table name where a column name is expected.
Try this instead:
SELECT o.neNesId, COUNT(*)
FROM ParNe AS o
WHERE o.neBanId = :neBanId
GROUP BY o.neNesId
Or replace the *
with a valid column name.
Upvotes: 2