我在询问和分组方面遇到问题。
I am needing the following output:
officr, cbal, sname
ABC, 500.00, TOM JONES
ABC, 200.00, SUE JONES
ABC TOTAL 700.00
RAR, 100.10, JOE SMITH
RAR, 200.05, MILES SMITH
RAR TOTAL 300.15
下面第5栏列出错误:
[DB2 for i5/OS]SQL0122 - ColumnNAME or expression in SlectT list not valid.
SELECT
lnmast.officr, SUM(LNMAST.CBAL), lnmast.sname
FROM
LNMAST
WHERE LNMAST.RATCOD IN (6,7,8) AND STATUS NOT IN ( 2 , 8 )
group by lnmast.officr