在mysql中命令不起作用

时间:2017-04-17 12:45:12

标签: mysql mysql-error-1064

嗨,当我调用此查询选择此作品并输出

select SUBSTR(img_address1,LOCATE('/',img_address2)+1,36)fROM content

但是当我进行此查询时,这会产生错误

SELECT id from content WHERE ((SUBSTR(img_address2,LOCATE('/',img_address2)+1,5) LIKE'salam')

这也会造成错误

SELECT id from content WHERE ((SUBSTR(img_address2,LOCATE('/',img_address2)+1,5) = 'salam')

我的错误是:

SELECT id from content WHERE ((SUBSTR(img_address2,LOCATE('/',img_address2)+1,5) = 'salam') LIMIT 0, 25
MySQL said: Documentation

 #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 0, 25' at line 1

1 个答案:

答案 0 :(得分:0)

(之前有一个额外的开放式括号SUBSTR。删除它将解决错误。

SELECT id from content WHERE (SUBSTR(img_address2,LOCATE('/',img_address2)+1,5) = 'salam') LIMIT 0, 25