mysql 查询字段中绝对匹配条件的语句是什么?

mysql 查询字段中绝对匹配条件的语句是什么?,第1张

只用IN *** 作符不对头,IN的逻辑就是“或”,number IN ('1','4','6','13')就相当于number='1' or number='4' or number='6' or number='13',而你的number中没有13(10个值里面没13),则或上等于13的,过滤效果就等同于没加这个条件,于是查出3条记录。

按你的意图,似乎是应该查出0条记录,大概需要写成如下命令:

select number from ABC

where number IN ('1','4','6','13')

and exists( select 1 from ABC where number='1' )

and exists( select 1 from ABC where number='4' )

and exists( select 1 from ABC where number='6' )

and exists( select 1 from ABC where number='13' )

SELECT * FROM 表名 where workplace like CONCAT("%人民%","%办%") or workplace like CONCAT("%东营区%","%人民%","%办%")

这样就可以了

-- 删除“才能

update db_centent set body = replace(body,'才能','')

-- 替换为“可以”

update db_centent set body = replace(body,'才能','可以')

希望能帮到你,加油!


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/8540972.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-17
下一篇 2023-04-17

发表评论

登录后才能评论

评论列表(0条)

保存