mysql 数据库查询和设计 MySQL的FIND_IN_SET()函数

MySQL的FIND_IN_SET()函数

NSERT 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');
 
test1:sql = select * from `test` where 'daodao' IN (`list`);
得到结果空值.
test2:sql = select * from `test` where FIND_IN_SET('daodao',`list`);
得到三条数据。

猜你喜欢

转载自www.cnblogs.com/bandbandme/p/10969590.html