产品类型有:A, B, C, D, E, F, G, H ... Z (多选的)
选择后保存到数据表product  type字段中, 形式为:A,B,D,K....现在我要查询出含有A,F,G类型的所有产品,该怎么查?

解决方案 »

  1.   

    select * from 表 where charindex(','+产品类型+',',',A,F,G,')>0
      

  2.   

    直接:
    where type like '%a%'
    and type like '%f%'
    and type like '%g%'
      

  3.   

    select * from product where 
    charindex(',' + 'A' + ',',',' + type + ',') > 0 and
    charindex(',' + 'F' + ',',',' + type + ',') > 0 and
    charindex(',' + 'G' + ',',',' + type + ',') > 0
      

  4.   

    现在我要查询出含有A,F,G类型的所有产品!select * from table where 
    charindex(',A,',','+type+',')>0 and 
    charindex(',F,',','+type+',')>0 
    charindex(',G,',','+type+',')>0 
    即可!
      

  5.   

    seelct * from tablename where 产品 like '%A%','%F%',%G%
    注意'%A%','%F%',%G%的排列顺序