1

我有一个表中的列,其中包含这样的值

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"

如何检查这四列中任何一列中包含的字符串中的任何一个字符

4

2 回答 2

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')
于 2012-11-28T05:31:03.803 回答
0
select * from t 
where 

'A,B' like '%'+class1+'%'
or
'A,B' like '%'+class2+'%'
or
'A,B' like '%'+class3+'%'
or
'A,B' like '%'+class4+'%'
于 2012-11-28T06:33:08.537 回答