Home  >  Article  >  Backend Development  >  mysql怎样查询不包括某个字符的结果?

mysql怎样查询不包括某个字符的结果?

WBOY
WBOYOriginal
2016-06-23 14:14:395948browse

MySQL

比如,我想查询不包括“张”,“王”,“李”这几个姓的结果。该 怎么写?

回复讨论(解决方案)

贴出表结构看看,数据是如何组织的。贴出一些示例数据。

贴出表结构看看,数据是如何组织的。贴出一些示例数据。
就一个字段,全是人名

select * from tt where 字段 not like '%张%'  and 字段 not like '%王%' and 字段 not like '%李%'

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn