您使用了聚合函数,
MAX()并且
SELECt子句中有一个未聚合的字段,这就是为什么您需要有
GROUP BY子句的原因,
SELECT tbl.column, MAX(tblOther.columnOtherId) AS otherID FROM (tbl INNER JOIN tblOther ON tbl.columnId = tblOther.columnOtherId) INNER JOIN tblOtherAgain ON tblOther.columnOtherId = tblOtherAgain.SourceId WHERe tblOther.columnOtherAgainId = @idGROUP BY tbl.column



