I know subquery return more than 1 value but I don't know how to change the code. Can anyone help me?
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)
)
I am guessing that you really intend something like this:
select Project
from Project_Table
where @sProject is NULL or Project = @sProject;
This will return the project in @sProject
or all projects if that value is NULL
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.