select * from 表 where charindex(','+产品类型+',',',A,F,G,')>0
直接: where type like '%a%' and type like '%f%' and type like '%g%'
select * from product where charindex(',' + 'A' + ',',',' + type + ',') > 0 and charindex(',' + 'F' + ',',',' + type + ',') > 0 and charindex(',' + 'G' + ',',',' + type + ',') > 0
现在我要查询出含有A,F,G类型的所有产品!select * from table where charindex(',A,',','+type+',')>0 and charindex(',F,',','+type+',')>0 charindex(',G,',','+type+',')>0 即可!
seelct * from tablename where 产品 like '%A%','%F%',%G% 注意'%A%','%F%',%G%的排列顺序
where type like '%a%'
and type like '%f%'
and type like '%g%'
charindex(',' + 'A' + ',',',' + type + ',') > 0 and
charindex(',' + 'F' + ',',',' + type + ',') > 0 and
charindex(',' + 'G' + ',',',' + type + ',') > 0
charindex(',A,',','+type+',')>0 and
charindex(',F,',','+type+',')>0
charindex(',G,',','+type+',')>0
即可!
注意'%A%','%F%',%G%的排列顺序