现在有个业务代码里有 like “XXX_%” 前缀匹配。但是 _ 这个符号会被认为是通配符,其实我想将它当作字符串匹配。百度了下,没有搜到我想要的答案,所以在这里跟大家请教下
1
wework 2020-01-21 09:56:49 +08:00
Try \%
|
2
manami 2020-01-21 10:00:51 +08:00
\_
|
3
Waterchestnut OP @wework 感谢老哥~果然可以~
|
4
Waterchestnut OP @manami 谢谢老哥,这个方法可行~
|
5
wework 2020-01-21 10:01:20 +08:00
@Waterchestnut sure , we work , no problem
|
6
manami 2020-01-21 10:01:59 +08:00
https://dev.mysql.com/doc/refman/5.7/en/string-comparison-functions.html
官方有写到“\_ matches one _ character.” |
9
Waterchestnut OP @wework niu bi,kao pu
|
10
jugelizi 2020-01-21 10:08:12 +08:00
所以 你在拼接 sql 语句!
|
11
wutongshuVVV 2020-01-21 11:47:55 +08:00
@jugelizi 盲生发现了华点( doge
|