在 sql where 条件中使用正斜杠

using farword slash in sql where condition

我正在尝试搜索以 / 开头的元素,下面是查询。

我已经试过了...

Select id,url from myindex where url='[/]%' ;

Select id,url from myindex where url='/%';

但没用。
有什么解决这个问题的建议吗?

你不想要 =。你想要like。第二种是MySQL:

的方法
Select id, url
from myindex
where url like '/%';
Select id,url from myindex where url like '/%';

使用mysql 通配符。在你的情况下试试这个

Select id,url 
from myindex 
where url like '/%';