这个问题很简单,可让我很是费解:
like语句的用法应该很简单,我写了三个like语句
1、select * from table where name like 'ac';执行有结果
2、select * from table where name like 'bc';执行有结果
3、select * from table where name like '[ab]c';执行却没结果了
在网上看了N篇文章,都是说 [abc]d 表示的就是“a或b或c开头,d结尾的字符串”,可我上面的第三个命令就是返回结果null。很郁闷,求解!!!
like语句的用法应该很简单,我写了三个like语句
1、select * from table where name like 'ac';执行有结果
2、select * from table where name like 'bc';执行有结果
3、select * from table where name like '[ab]c';执行却没结果了
在网上看了N篇文章,都是说 [abc]d 表示的就是“a或b或c开头,d结尾的字符串”,可我上面的第三个命令就是返回结果null。很郁闷,求解!!!
要用正则吧
select * from table where REGEXP_LIKE(name, '[ab]c')
select * from table where name in ('ac', 'bc')