MS-Access - 您尝试执行不包含指定聚合函数的查询,还有其他任何解决方案吗?

时间:2016-06-27 05:48:07

标签: sql vba ms-access

 SQL = "TRANSFORM FIRST(a.TimeStamp1) "
 SQL = SQL & "SELECT a.DealName, DealList.SettlementDate "
 SQL = SQL & "FROM DealList, DealStepLog a INNER JOIN DealStepMasterData b on b.StepName = a.DealStep "
 SQL = SQL & "WHERE b.StepClassification = 'Compliance' "
 SQL = SQL & "GROUP BY DealName "
 SQL = SQL & "PIVOT dealStep "

我知道我必须在GROUP BY部分放置'SettlementDate',但我不想按settlementDate,任何其他选项进行分组?

1 个答案:

答案 0 :(得分:1)

然后你必须使用其中一个聚合函数,例如其中一个:

First(SettlementDate)
Last(SettlementDate)
Max(SettlementDate)
Avg(SettlementDate)
Min(SettlementDate)