【发布时间】:2022-01-06 02:18:38
【问题描述】:
这是我的 SQL 语句:
Set @xyz = @xyz + isnull(@Where, @And) + ' ' + @ColName +
' in (select max(cid) from demo where status = RELEASE group by cid)'
消息 207,第 16 级,状态 1,第 1 行
列名“RELEASE”无效。
select max(cid)
from demo
where status = RELEASE
group by cid
独立执行时工作正常。
但是当它在子查询中追加时会导致无效的列名 RELEASE 错误
【问题讨论】:
标签: sql subquery where-clause