我有一个表中的列,其中包含类似
的值class1 class2 class3 class4
A D 0 0
0 A B 0
B 0 0 C
A 0 D 0
我有像First="A,B"
,Second="C,D"
如何检查这四列中任何一列中包含的字符串中的任何一个字符
答案 0 :(得分:0)
select * from yourtable where class1 in('A,B,C,D')
UNION
select * from yourtable where class2 in('A,B,C,D')
UNION
select * from yourtable where class3 in('A,B,C,D')
UNION
select * from yourtable where class4 in('A,B,C,D')
答案 1 :(得分:0)
select * from t
where
'A,B' like '%'+class1+'%'
or
'A,B' like '%'+class2+'%'
or
'A,B' like '%'+class3+'%'
or
'A,B' like '%'+class4+'%'