回答

收藏

SQL:``在选择列表中,'olumn'tbl.column'是无效的,因为它既

技术问答 技术问答 320 人阅读 | 0 人回复 | 2023-09-12

我想知道为什么会出现以下错误:1 R+ @2 U* K. ^
Column 'tbl.column' is invalid in the select list because it is not contained7 Z/ Y" N" s/ D* r# ?& g
in either an aggregate function or the GROUP BY clause.9 i; K1 b$ \, @! d/ a* s7 r4 x
sql语句如下:* `$ |, e; i" ~, D
SELECT tbl.column, MAX(tblOther.columnOtherId) AS otherID FROM (tbl INNER1 p, w7 p% c' h& P& W- a. W
JOIN tblOther ON tbl.columnId = tblOther.columnOtherId) INNER JOIN; F2 m8 n3 h8 w- K- Y% j
tblOtherAgain ON tblOther.columnOtherId = tblOtherAgain.columnAgainOtherId5 W! b/ \  |. r
WHERE tblOther.columnOtherAgainId = @id。/ q( t; A7 A; ~0 ?: B& L
当我删除聚合函数 MAX时9 h7 k6 ^  x; R* D  h; k/ g; w
,tblOther.columnOtherId我没有收到以上错误。那么,如何在不出现所示错误的情况下使上面显示的语句起作用?
2 N* p& n% `  C$ K; B3 B7 z1 PDBLibrary: Tedious.js
6 |- a. _$ a3 p' Y+ a6 R: y                  R) [" c' N) F
解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则