回答

收藏

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

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

我想知道为什么会出现以下错误:% i# ^4 A  e" Z2 g& L8 P) ~
Column 'tbl.column' is invalid in the select list because it is not contained; ?! N' D8 F5 X8 f! ^) X9 u0 j
in either an aggregate function or the GROUP BY clause.% a1 z. M/ J# F+ N$ O
sql语句如下:, {2 r# w7 {) v' l
SELECT tbl.column, MAX(tblOther.columnOtherId) AS otherID FROM (tbl INNER
+ j; V* K% F9 |3 d2 @JOIN tblOther ON tbl.columnId = tblOther.columnOtherId) INNER JOIN" ?% [4 a0 i+ f5 _2 a$ I$ y3 i
tblOtherAgain ON tblOther.columnOtherId = tblOtherAgain.columnAgainOtherId8 e& w% s2 B7 m4 }" S$ n6 n
WHERE tblOther.columnOtherAgainId = @id。" Z* D* x$ s5 O: _7 e% u0 Y" f) d8 x
当我删除聚合函数 MAX时
, n1 q3 j4 A4 M,tblOther.columnOtherId我没有收到以上错误。那么,如何在不出现所示错误的情况下使上面显示的语句起作用?1 S0 t! @1 G  f
DBLibrary: Tedious.js
8 m0 R: q. |2 b1 K: {               
4 \4 O( n' j! S# C6 ?6 J* [9 g解决方案:
分享到:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则