[英]Subquery returned more than 1 value. This is not permitted when the subquery follows>= or when the subquery is used as an expression
[英]Subquery returned more than 1 value. This is not permitted when the subquery follows … or when the subquery is used as an expression
我知道子查询返回超过 1 个值,但我不知道如何更改代码。 谁能帮我?
declare @sProjectNumber nvarchar(200)
( select Project from Project_Table where Project in (
select case
when @sProject is null then (select distinct Project from Project_Table)
else @sProject end
from Project_Table)
)
我猜你真的打算这样:
select Project
from Project_Table
where @sProject is NULL or Project = @sProject;
如果该值为NULL
,这将返回@sProject
中的项目或所有项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.