------解决方案-------------------- where a in(1,2,3,4)
------解决方案--------------------
SQL code
declare @str varchar(20)
set @str='1,2,3,4'
select * from tbl where charindex(','+ltrim(a),','+@str)>0
------解决方案-------------------- where a in(1,2,3,4) and b='anything' and c=……
------解决方案--------------------
------解决方案-------------------- 用in来实现嘛,相当于是要查的变量的集合 where ?? in(1,2,3)
------解决方案-------------------- where a in( select a=1 union select 2 union select 3) and a not in( select a=4 union select 5 union select 6) and b.... and c....