怎么查找带英文中的"?"的字符串??????????????

outred2000 2009-10-16 09:21:34
怎么查找英文中带"?"的字符串;
比如:我要查找一个table表中字段str的内容包含有"?"的所有记录出来,SQL如下:
select * from table where str regexp '?';
select * from table where str regexp '\?';
上面两条执行的结果均报错:
#1139 - Got error 'repetition-operator operand invalid' from regexp


正确的写法怎么写呢????????
...全文
83 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
nianzhang747 2009-10-16
  • 打赏
  • 举报
回复
regexp '\\?';

或者用like
ACMAIN_CHM 2009-10-16
  • 打赏
  • 举报
回复
mysql> select 'adf?adf' regexp '\\?';
+------------------------+
| 'adf?adf' regexp '\\?' |
+------------------------+
| 1 |
+------------------------+
1 row in set (0.00 sec)
ACMAIN_CHM 2009-10-16
  • 打赏
  • 举报
回复
select * from table where str regexp '\\?';

阿_布 2009-10-16
  • 打赏
  • 举报
回复

select * from t where name REGEXP '[^\\?]*\\?\\.*';
wwwwb 2009-10-16
  • 打赏
  • 举报
回复
SELECT * FROM bb WHERE mobile LIKE '%\?%'
vinsonshen 2009-10-16
  • 打赏
  • 举报
回复
select   *   from   table   where   locate( '? ', 'str ')> 0; 



select * from table where instr( 'str ', '? ')> 0;
vinsonshen 2009-10-16
  • 打赏
  • 举报
回复
select * from table where locate('?','str')>0;



select * from table where instr('str','?')>0;

56,678

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧