Mysql在查询中搜索正斜杠/

时间:2012-05-10 12:25:30

标签: mysql

我正在尝试在表格中进行简单查询,在没有运气的情况下搜索某个位置。

SELECT SUBSTRING(`path`, 40, 40) LIKE '%/%'
FROM files

有人能帮助我吗?

3 个答案:

答案 0 :(得分:0)

不应该吗?

SELECT *
FROM files
WHERE SUBSTRING(`path`, 40, 40) LIKE '%/%'

答案 1 :(得分:0)

您可以这样做(如果您知道将要出现的位置,则提供)

SELECT SUBSTRING(`path`, 40, 40) as slashpath  FROM files 
where SUBSTRING(`path`, 40, 40) LIKE '%/%' 

答案 2 :(得分:0)

试试此代码

SELECT SUBSTRING(`path`, 40, 40) path  
FROM files 
where substring(`path`, 40,40) like '%/%'