Skip to content
Advertisement

ORA-00904 invalid identifier error

I get ORA-00904 ‘c’ invalid identifier error. What is wrong with this alias ?

select NO, count(JOINT_NO) as c
from JOINT
WHERE HOLDER = 'Y' AND JOINT.c > 1
GROUP BY NO;

Advertisement

Answer

I think you want to fetch those records having count > 1. So you can’t use Indentifier C in the WHERE clause of the same query.

select NO, count(JOINT_NO) as c
from JOINT
WHERE HOLDER = 'Y'
GROUP BY NO
HAVING COUNT(JOINT_NO)>1;
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement