2012-11-23 105 views
2

我得到ORA-00904'c'無效標識符錯誤。這個別名有什麼問題?ORA-00904無效標識符錯誤

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

回答

3

我想你想獲取其計數> 1,所以你不能在同一查詢WHERE子句中使用Indentifier C這些記錄。

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

有表JOINT不存在列c,導致你所得到的錯誤消息。

更改您的查詢是這樣的:

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