如查询包含的: select * from table1 where aa like '%关键字%'
问下怎么查找 不包含 '关键字' 记录?
8 个解决方案
#1
select * from table1 where aa not like '%关键字%'
#2
select * from table1 where aa like '%[^关键字]%'
#3
select * from table1 where aa not like '%关键字%'
select * from table1 where chindex('关键字' , aa) = 0
#4
node~
#5
select * from table1 where charindex('关键字' , aa) = 0
#6
select * from table1 where patindex('%关键字%' , aa) = 0
#7
select * from table1 where patindex('%关键字%' , aa) = 0
select * from table1 where charindex('关键字' , aa) = 0
select * from table1 where charindex('关键字' , aa) = 0
#8
select * from table1 where patindex('%关键字%' , aa) = 0
select * from table1 where charindex('关键字' , aa) = 0
select * from table1 where aa like '%关键字%'
#1
select * from table1 where aa not like '%关键字%'
#2
select * from table1 where aa like '%[^关键字]%'
#3
select * from table1 where aa not like '%关键字%'
select * from table1 where chindex('关键字' , aa) = 0
#4
node~
#5
select * from table1 where charindex('关键字' , aa) = 0
#6
select * from table1 where patindex('%关键字%' , aa) = 0
#7
select * from table1 where patindex('%关键字%' , aa) = 0
select * from table1 where charindex('关键字' , aa) = 0
select * from table1 where charindex('关键字' , aa) = 0
#8
select * from table1 where patindex('%关键字%' , aa) = 0
select * from table1 where charindex('关键字' , aa) = 0
select * from table1 where aa like '%关键字%'