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)
热门推荐
10 病人祝福语老师寄语简短
11 新娘生孩子祝福语简短
12 婆婆66岁祝福语简短
13 今天孩子高考祝福语简短
14 送彩票生日祝福语简短
15 分别祝福语简短情话英文
16 画室揭牌仪式祝福语简短
17 女友妈妈生日祝福语简短
18 离别赠言离职祝福语简短