Error: java.sql.Sqlsyntaxerrorexception: ORA-00979: not a GROUP BY Expression Please correct SELECT statement

Asked

Viewed 14 times

0

I am having this error after the query. $A$ is the table nickname! I need to know how many records have duplicate number, but my query is wrong and I am unable to find the error!

SELECT $A$.MOBILE_NUMBER_  AS NUMERO
,COUNT($A$.MOBILE_NUMBER_)
,$A$.CREATED_DATE_  
,$A$.EMAIL_PERMISSION_STATUS_  
FROM $A$   
WHERE $A$.CREATED_DATE_ >= TO_DATE('2021/04/22', 'yyyy/mm/dd')
AND   $A$.CREATED_DATE_ <= TO_DATE('2021/04/22','yyyy/mm/dd')
HAVING COUNT($A$.MOBILE_NUMBER_) > 2
GROUP BY $A$.MOBILE_NUMBER_

Error: java.sql.Sqlsyntaxerrorexception: ORA-00979: not a GROUP BY Expression Please correct SELECT statement: SELECT $A$. MOBILE_NUMBER_ AS NUMERO ,COUNT($A$.MOBILE_NUMBER_) ,$A$. CREATED_DATE_ ,$A$. EMAIL_PERMISSION_STATUS_ FROM $A$ WHERE $A$. CREATED_DATE_ >= TO_DATE('2021/04/22', 'yyyy/mm/dd') AND $A$. CREATED_DATE_ <= TO_DATE('2021/04/22','yyyyyy/mm/dd') HAVING COUNT($A$.MOBILE_NUMBER_) > 2 GROUP BY $A$. MOBILE_NUMBER_

  • The group by has to , on Oracle , have all the columns of select , having comes after the group by. I believe this is it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.