Home >Database >Mysql Tutorial >mysql中FIND_IN_SET的应用(判断某字符串是否在带逗号的字符串之_MySQL

mysql中FIND_IN_SET的应用(判断某字符串是否在带逗号的字符串之_MySQL

WBOY
WBOYOriginal
2016-06-01 13:40:381080browse

bitsCN.com
mysql中FIND_IN_SET的应用(判断某字符串是否在带逗号的字符串之中) Sql代码  测试代码:   CREATE TABLE `test` (    `id` int(8) NOT NULL auto_increment,    `name` varchar(255) NOT NULL,    `list` varchar(255) NOT NULL,    PRIMARY KEY  (`id`)  )        INSERT INTO `test` VALUES (1, 'name', 'daodao,xiaohu,xiaoqin');  INSERT INTO `test` VALUES (2, 'name2', 'xiaohu,daodao,xiaoqin');  INSERT INTO `test` VALUES (3, 'name3', 'xiaoqin,daodao,xiaohu');    test:sql = select * from `test` where FIND_IN_SET('daodao',`list`);  得到三条数据。  bitsCN.com

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