您好:
請問
declare @w as varchar(4)
set @w=1 或 者 set @w=''
select *
from table
where wx in ( case when @w='' then 'X','B'
ELSE @w
)
但是 then 'X','B',這樣不能過
於是 then ( select w from w_table ) ,這樣可以多筆,可使就會回傳 該語法下不能多筆
請問,有方法可以 讓他多筆嗎?
謝謝
你的條件怪怪的~我的應該會是這樣~
declare @w as varchar(4)
set @w=1 或 者 set @w=''
select *
from table
where (1=2
or (@w='' and wx in('X','B'))
or @w='1'
)
SQL Server 2016 開始有 STRING_SPLIT,了解一下是否有幫助