要模糊查找字段中包含百分号%的SQL语句怎么写

2025-03-23 14:17:55
推荐回答(3个)
回答(1):

select * from 表名 where 字段 like '%\%%' ESCAPE '\'

回答(2):

Mysql里用\%,比如:

select * from t where name like '%te\%abc%';

回答(3):

在like后面的模糊搜索字串中的百分号%之前使用转义字符,比如\,再用escape指定该转义字符,例如
like 'abc\%ef' escape '\'