问题描述
为了演示[]的用法mysql> select username from user limit 5;+----------+| username |+----------+| admin || test || test1 || test2 || test3 |+----------+5 rows in set (0.00 sec)mysql> select username from user where username like '%[a-t]%' limit 5;查找了包含a到t之间的字符Empty set (0.00 sec)mysql> select username from user where username like '[t]%' limit 5;查找t开通的字符Empty set (0.00 sec)怎么后面两天找不到数据。 问题补充:mysql> select username from user where username like 't[ae]st' limit 5;Empty set (0.00 sec)
解决方案
你需要的是正则表达式语法如select * from base_customer where customerId regexp '^[t].*' limit 0, 5;
解决方案二:
select username from user where username like '.[ae]*' limit 5;
解决方案三:
[a-t] 表明这个是1个字符的。。从a到t.
时间: 2024-11-04 00:01:01