SQL:``在选择列表中,'olumn'tbl.column'是无效的,因为它既
技术问答
288 人阅读
|
0 人回复
|
2023-09-12
|
我想知道为什么会出现以下错误:
: t: C3 F5 ~8 e# E$ k' Z" ]) BColumn 'tbl.column' is invalid in the select list because it is not contained/ i$ c6 Y9 O- U2 i! z* V4 \
in either an aggregate function or the GROUP BY clause.0 q ~' ^: C$ w+ l8 p' Z
sql语句如下:8 s+ n% x: o) F6 {) Q- ~6 L
SELECT tbl.column, MAX(tblOther.columnOtherId) AS otherID FROM (tbl INNER6 V+ r4 S; \3 r. Y2 s3 m
JOIN tblOther ON tbl.columnId = tblOther.columnOtherId) INNER JOIN% h. w0 J2 r5 {/ ]0 Q, f4 H6 T# s
tblOtherAgain ON tblOther.columnOtherId = tblOtherAgain.columnAgainOtherId
l' |* G$ D6 K+ ]: O( P( ~WHERE tblOther.columnOtherAgainId = @id。, r* _# l, w" u; v# Q: S) F) {
当我删除聚合函数 MAX时 U8 ?+ P# D9 u; }4 Z1 c9 C
,tblOther.columnOtherId我没有收到以上错误。那么,如何在不出现所示错误的情况下使上面显示的语句起作用?
% ?. f* @3 g! D" `DBLibrary: Tedious.js
8 ?0 Z1 e2 T$ V c. n ; `1 N- A# {9 L* V1 t; T' \
解决方案: |
|
|
|
|
|