我正在运行以下 SQL,但不断收到错误消息:-
'列 'SRVS.dbo.BTQGLDistributionsWithProjectCodesHM.AccountNo' 在选择列表中无效,因为它不包含在聚合函数或 GROUP BY 子句中。
我正在运行的代码是:-
SELECT AccountNo,
TransDate,
JournalNo,
AuditTrail,
Description,
JnlAmount,
ACTINDX,
CONTRACTNAME,
PAPROJNUMBER,GROUPING(PAPROJNUMBER) as PAPROJNUMBER,
SUM(PAFeebillamount) as total
FROM SRVS.dbo.BTQGLDistributionsWithProjectCodesHM
GROUP BY PAPROJNUMBER with rollup
ORDER BY GROUPING (PAPROJNUMBER
谁能指出我正确的方向?