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"
如何檢查任何一個從字符串包含在這些四列的性格
我有在包含這樣檢查任何列包含字符從一個字符串
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"
如何檢查任何一個從字符串包含在這些四列的性格
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')
select * from t
where
'A,B' like '%'+class1+'%'
or
'A,B' like '%'+class2+'%'
or
'A,B' like '%'+class3+'%'
or
'A,B' like '%'+class4+'%'
感謝您ÿ我們的回覆,但需要時間 – Sajir
嘗試此更新後的查詢 – AnandPhadke