当前位置: 代码迷 >> Sql Server >> 刚才问的有关问题还没解决,请各位帮忙,在线
  详细解决方案

刚才问的有关问题还没解决,请各位帮忙,在线

热度:57   发布时间:2016-04-27 20:28:12.0
刚才问的问题还没解决,请各位帮忙,在线
比如我们的产品中有     SM/W/JC   ,TY/JY,   LK/FK     SA/YU....     我想过滤掉其中的一部分产品。   如想过滤掉含有   SM,JT,FK   的   我用上面的试了一下不行.

------解决方案--------------------
select * from t where 字段 not like '%SM% ' and 字段 not like '%FK% ' and 字段 not like '%JT% '
------解决方案--------------------
select * from 表名 where patindex( '%[SM]% ',列名) = 0 AND patindex( '%JT]% ',列名) = 0 and patindex( '%[FK]% ',列名) = 0
------解决方案--------------------
select * from 表名 where charindex( 'SM ',列名) <1 AND charindex( 'JT ',列名) <1 and charindex( 'FK ',列名) <1
  相关解决方案