表aa
a b c          d e f                   g1000 0 sdafsadfd sdfsda 500 10 100,102,1000,1020, 0
1001 0 sdafsadfd sdfsda 500 10 100,102,1000,2000, 0
1002 0 sdafsadfd sdfsda 500 10 100,102,1000, 0
传过来个字符串 '100,2000,'意思是包含  '100,'   并且包含    '2000,'的数据sql怎么写 啊应该是查到第二行

解决方案 »

  1.   

    select * from aa where a in (100,2000) or b in (100,2000) or c in (100,2000) or d in (100,2000) or e in (100,2000) or f in (100,2000) or g in (100,2000)
      

  2.   

    f100,102,1000,1020,只查询 F字段就好格式和我发布时候不太一样,不好意思f是字符串哦
      

  3.   

    select * from aa where f like '%100%' or f like '2000'
      

  4.   

    少个%
    select * from aa where f like '%100%' or f like '%2000%'
      

  5.   

    select * from aa where (g like (100) and g like (2000))
      

  6.   


    --包含100, 并且包含2000, 你的意思是只有第二条数据复合吧。
    select * from aa where f like '%100,%2000,%'   
      

  7.   

    1000 0 sdafsadfd sdfsda 500 10 100,102,1000,1020, 0是分别对应的表aa中的a b c d e f g列吗?