我正在SEQUEL ViewPoint中创建一个脚本。在脚本上,我有3行执行各种视图来过滤掉数据。然后,最后一行显示使用临时表的数据结果,其他视图已插入到脚本的前一行。
我的剧本的最后一行类似于:
DISPLAY SQL('SELECT sys, COUNT(memno) as memCount, Memno, userName, address FROM QTEMP/addrchg2 GROUP BY memno, sys, userName, address ORDER BY sys')
我尝试做的只是显示[memCount]大于2的显示记录。当我尝试在WHERE memCount > 2
收到FROM QTEMP/addrchg2
之后放行Escape: Query definition template 1 not valid.
Diagnostic: Field MEMCOUNT specified in WHERE clause not valid.
Escape: Query not created due to errors in specification.
An error occurred while running the command on line 4.
时:
[memCount]
我如何最好地修改脚本的最后一行以仅显示DISPLAY SQL('SELECT sys, COUNT(memno) as memCount, Memno, userName, address FROM QTEMP/addrchg2 GROUP BY memno, sys, userName, address HAVING COUNT(memno) > 2 ORDER BY sys')
大于2的记录?
修改
{{1}}
我现在收到了结果。通过并验证它们是否正确我所追求的目标。
答案 0 :(得分:1)
DISPLAY SQL('SELECT sys, COUNT(memno) as memCount, Memno, userName, address FROM QTEMP/addrchg2 GROUP BY memno, sys, userName, address HAVING COUNT(memno)>2 ORDER BY sys')
别名,不能用这种方式。我猜HAVING
就是你要找的。 p>
我已将HAVING COUNT(memno)>2
添加到您的查询中。