MySql 查询字段中包含字符串

Nik*_*hil 4 mysql sql

这个问题可能被问了好几次,我检查了所有的问题,但我无法得到答案。我的数据库“测试”中有一个名为变量的字段。我已经执行了查询

select 'variables' from test WHERE variables LIKE '%{$ifIndex}%';
Run Code Online (Sandbox Code Playgroud)

变量字段包含逗号分隔的字符串,例如ifIndex, IfType, IfStatus 但我无法获取它!

Ham*_*yan 5

当您仅使用任一侧通配符的 % 放置要查找的字符串时,这将实现您想要的结果。

select variables from test WHERE variables LIKE '%ifIndex%';
Run Code Online (Sandbox Code Playgroud)