我有一个查询
SELECT COUNT(*) AS "CNT",imei FROM devices
执行得很好.我想用WHERE语句进一步限制查询. (人性)逻辑下一步是随后修改查询:
SELECT COUNT(*) AS "CNT",imei FROM devices WHERE CNT > 1
但是,这会导致错误消息ORA-00904:“CNT”:标识符无效.出于某种原因,将查询包装在另一个查询中会产生所需的结果:
SELECT * FROM (SELECT COUNT(*) AS "CNT",imei FROM devices GROUP BY imei) WHERE CNT > 1
为什么Oracle在第二个查询中无法识别别名“CNT”?