当我在“我的报告”中使用TR.DocNo字段时,查询设计中的查询运行正常。弹出错误消息:
Multi-level Group By clause is not allowed in a sub query.
任何想法如何解决它,谢谢
SELECT T.traID,
IIf(T.trawrhIDTo,"Purchase"," Sales ") AS FormSorP,
T.traDocNoID,
W.wrhName,
TS.trsPrice,
TS.trsVatRate,
TS.trsAuxField,
WI.whiAdjustment,
W.wrhCountry,
T.traDate AS TDATE,
TS.trsSubTotalGross,
C.cstName AS CName,
TR.DocNo
(SELECT tblTransactionsSC.traDocNoID AS DocNo
FROM tblTransactionsSC
WHERE (((tblTransactionsSC.traID)=[Forms]![frmReturns]![tratraID]))) AS TR
FROM tblWarehouse AS W
INNER JOIN ((tblTransactionsSC AS T LEFT JOIN tblCustomer AS C ON T.tracstID = C.cstID)
INNER JOIN (tblTransactionsSubSC AS TS
LEFT JOIN tblWarehouseItem AS WI ON TS.trswhiID = WI.whiID) ON T.traID = TS.trstraID) ON W.wrhID = T.trawrhID
WHERE (((T.traID)=[Forms]![frmReturns]![traID]));
答案 0 :(得分:1)
你缺少逗号检查
SELECT T.traID,
IIf(T.trawrhIDTo,"Purchase"," Sales ") AS FormSorP,
T.traDocNoID,
W.wrhName,
TS.trsPrice,
TS.trsVatRate,
TS.trsAuxField,
WI.whiAdjustment,
W.wrhCountry,
T.traDate AS TDATE,
TS.trsSubTotalGross,
C.cstName AS CName,
TR.DocNo,
(SELECT tblTransactionsSC.traDocNoID AS DocNo
FROM tblTransactionsSC
WHERE (((tblTransactionsSC.traID)=[Forms]![frmReturns]![tratraID]))) AS TR
FROM tblWarehouse AS W
INNER JOIN ((tblTransactionsSC AS T LEFT JOIN tblCustomer AS C ON T.tracstID = C.cstID)
INNER JOIN (tblTransactionsSubSC AS TS
LEFT JOIN tblWarehouseItem AS WI ON TS.trswhiID = WI.whiID) ON T.traID = TS.trstraID) ON W.wrhID = T.trawrhID
WHERE (((T.traID)=[Forms]![frmReturns]![traID]));