FIND_IN_SET的简单使用
FIND_IN_SET(str,strlist)函数
str 要查询的字符串
strlist 字段名 参数以”,”分隔 如 (1,2,6,8)
查询字段(strlist)中包含(str)的结果,返回结果为null或记录

-- 1
select find_in_set('1', '1,2,3,4,5,6'); -- 2
select find_in_set('2', '1,2,3,4,5,6');
-- 0
select find_in_set('7', '1,2,3,4,5,6');
-- 0
select find_in_set('2', '1,21,3,4,5,6');
-- 0
select find_in_set('2', '');
-- 0
select find_in_set('2', '1,2 ,3,4,5,6');
-- NULL
select find_in_set(NULL, '1,2,3,4,5,6');
-- NULL
select find_in_set(1, NULL);
-- 0
select find_in_set('2,3', '1,2,3,4,5,6');

test表中(area(0,不同意 1,同意))
下面我想查询area中包含”1″这个参数的记录
SELECT * from test where FIND_IN_SET('1',area)
返回值
返回 area=1的数据....
FIND_IN_SET的简单使用的更多相关文章
- Mysql函数FIND_IN_SET()的使用方法
有了FIND_IN_SET这个函数.我们可以设计一个如:一只手机即是智能机,又是Andriod系统的. 比如:有个产品表里有一个type字段,他存储的是产品(手机)类型,有 1.智能机,2.Andri ...
- mysql查找以逗号分隔的值-find_in_set
有了FIND_IN_SET这个函数.我们可以设计一个如:一只手机即是智能机,又是Andriod系统的. 比如:有个产品表里有一个type字段,他存储的是产品(手机)类型,有 1.智能机,2.Andri ...
- sphinx教程
http://www.php100.com/html/it/focus/2013/0916/6188.html### 以上一篇的email数据表为例: 数据结构: 01.CREATE TABLE em ...
- sphinx全文检索之PHP使用(转)
基础 数据结构: CREATE TABLE email ( emailid mediumint(8) unsigned NOT NULL auto_increment COMMENT '邮件id', ...
- sphinx全文检索之PHP使用教程
以上一篇的email数据表为例: 数据结构: 01.CREATE TABLE email ( 02.emailid mediumint(8) unsigned NOT NULL auto_increm ...
- 【MySQL】MySQL的find_in_set的使用例子
> 参考的优秀文章 FIND_IN_SET(str,strlist) > 简单的例子 这个函数的功能是,在第二个参数中寻找第一个参数,并返回第一个参数所在的位置,不存在则返回0.其中,第二 ...
- Hive 的简单使用及调优参考文档
Hive 的简单使用及调优参考文档 HIVE的使用 命令行界面 使用一下命令查看hive的命令行页面, hive --help --service cli 简化命令为hive –h 会输出下面的这 ...
- mysql find_in_set函数详解
Mysql函数FIND_IN_SET()的使用方法 有了FIND_IN_SET这个函数.我们可以设计一个如:一只手机即是智能机,又是Andriod系统的. 比如:有个产品表里有一个type字段,他存储 ...
- Mysql中FIND_IN_SET和REPLACE函数简介
一 FIND_IN_SET() SELECT * from u_user where FIND_IN_SET('32',tags) 上面的sql是精确查找,查找表中tags中含有32的记录(注意这里 ...
随机推荐
- 更新mac系统和更新到Xcode7.3版本出现的: cannot create __weak reference in file using manual reference counting
之前的编程没有遇到过,应该是苹果官方那边又做了新规吧. 不过不要紧,只要根据这个就能解决报错问题. Set Build Settings -> Apple LLVM 7.1 - Languag ...
- python数据分析之numpy
知乎:https://zhuanlan.zhihu.com/p/26514493 numoy安装:http://blog.csdn.net/wyc12306/article/details/53705 ...
- 防火墙系列之firewall
firewalld 介绍 防火墙守护 firewalld 服务引入了一个信任级别的概念来管理与之相关联的连接与接口.它支持 ipv4 与 ipv6,并支持网桥,采用 firewall-cmd (com ...
- (转)gethostbyname() -- 用域名或主机名获取IP地址
struct hostent *gethostbyname(const char *name); 这个函数的传入值是域名或者主机名,例如"www.google.cn"等等.传出值, ...
- [Spring Data MongoDB]学习笔记--牛逼的MongoTemplate
MongoTemplate是数据库和代码之间的接口,对数据库的操作都在它里面. 注:MongoTemplate是线程安全的. MongoTemplate实现了interface MongoOperat ...
- Win7系统安装 MySQL 5.7.23
1. 下载 MySQL 5.7版本:https://dev.mysql.com/downloads/mysql/5.7.html#downloads 2. 解压到指定文件夹,mysql根目录下创建my ...
- linux解压war包
可以用unzip命令 unzip project.war -d project 这样就在当前目录下解压project.war到project目录里面,参数-d的意思是创建project目录 附:unz ...
- 第五课 nodejs 路由实现并处理请求作出响应
1创建一个http Server 文件server.js var http = require('http');var url = require('url');function start(rout ...
- 高德地图API使用
1.根据地址找经纬度/修改经纬度 marker.setPosition(result.geocodes[0].location); map.setCenter(marker.getPosition() ...
- vue禁止复制的方式
普通网页禁止复制的功能这里不再叙述,自行学习 https://blog.csdn.net/qq_32963841/article/details/84656752 这里简单写一下vue中怎么禁止使用复 ...