![](/img/trans.png)
[英]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.