MySQL选择值在IN列表字符串中?
为此,请使用FIND_IN_SET()。
让我们创建一个表-
示例
mysql> create table demo81 -> ( -> id int not null auto_increment primary key, -> username varchar(200) -> );
以下是查询以选择值在IN列表字符串中的位置-
示例
mysql> select *from demo81 where find_in_set('Chris',username) > 0;这将产生以下输出-
输出结果
+----+------------------+ | id | username | +----+------------------+ | 1 | John,Chris,David | | 3 | Chris,Bob,Sam | | 4 | Mike,John,Chris | +----+------------------+ 3 rows in set (0.03 sec)
热门推荐
4 天仓节祝福语简短
10 关于健康的祝福语简短
11 送同学的简短祝福语
12 艺校元旦祝福语大全简短
13 小托班祝福语简短
14 新年祝福语2026最简短
15 男孩中考蛋糕祝福语简短
16 进新房的祝福语 简短
17 离别赠言离职祝福语简短
18 2026腊八简短祝福语