(或SLV未定义)Informix数据库

app*_*ppi 2 sql database informix

任何人都可以帮我在这里找出这个小查询中的错误.

select count(txno) as c1, rxno  from mrgrxtxt 
where c1>1
group by rxno;
Run Code Online (Sandbox Code Playgroud)

错误: [Error Code: -217, SQL State: IX000] Column (c1) not found in any table in the query (or SLV is undefined).

如果我注释掉WHERE子句(where c1 >1),它执行正常.

Gor*_*off 5

您不能在a中使用列别名where.真的,你需要一个having条款.

试试这个:

select count(txno) as c1, rxno 
from mrgrxtxt 
group by rxno
having count(txno) > 1;
Run Code Online (Sandbox Code Playgroud)