一、查询包含“,”的列

1.如果查询条件包含单引号

用in

如:select * from t_test where names in ('李红');

只能查询出names列中值为‘李红’的数据

select * from t_test where names in ('李红,李华');

只能查询出names列中值为‘李红,李华’的数据

用find_in_set

如:select * from t_test where FIND_IN_SET('李红',names );

能查出names列中包含‘李红’的列 如:李红,李华;李丽,李红;小明,李红

select * from t_test where FIND_IN_SET('李红,李华',names );

不能查询任何数据

2.如果查询条件不包含单引号

用in

如:select * from t_test where names in (李红);

只能查询出names列中第一个值为‘李红’的数据。 如:李红,李华;李红,小明;不能查出:小明,李红。

select * from t_test where names in (李红,李华);

只能查询出names列中第一个值为‘李红‘的数据。

用find_in_set

如:select * from t_test where FIND_IN_SET(李红,names );

能查出names列中包含‘李红’的列 如:李红,李华;李丽,李红;小明,李红

最新文章

  1. 在Ubuntu 16.10 安装 git 并上传代码至 git.oschina.net
  2. C#_技巧:真伪随机数
  3. JBoss AS
  4. Thinkphp源码分析系列(九)–视图view类
  5. asp.net“服务器应用程序不可用” 解决方法
  6. LICEcap
  7. svn配置
  8. Android环境rm命令
  9. UVA 657 The die is cast
  10. 通过MYSQL命令行直接建数据库
  11. centos 7 epel地址
  12. ecshop开发日志之支付插件开发
  13. aspx向silverlight传值
  14. eclipse环境下如何配置tomcat
  15. SQL之Left Join 关联条件的探讨
  16. 『计算机视觉』物体检测之RefineDet系列
  17. EFCore Lazy Loading + Inheritance = 干净的数据表 (一) 【献给处女座的DB First程序猿】
  18. WebSocket简单尝试
  19. C#语言————第四章 常用Convert类的类型转换方法
  20. StackExchange.Redis 管道 批量 高性能插入数据

热门文章

  1. Vue学习笔记之组件与通信
  2. pat乙级:模拟链表问题(汇总,包含所有pat中链表题目分析)
  3. LeetCode-2013 检测正方形
  4. 从源码MessageSource的三个实现出发实战spring·i18n国际化
  5. python中操控excel的几个库:xlwt,xlrd,xlutils
  6. Vs出现调试问题
  7. 疑问:如何替代dtb文件
  8. Neighborhood Attention Transformer概述
  9. 阿里云服务器ECS(Centos8)下安装和配置python3.8
  10. oracle收缩表和表空间