#1064 -在SQL语法中有一个错误;检查与MySQL对应的手册。

时间:2022-03-29 14:55:25
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '-sporocilo us, uporabnik u WHERE ( 's%' LIKE
u.uuser) AND (s.SID = us.SID) AND (' at line 2   

this is the error i get ...

这是我得到的错误。

SQL:

SQL:

SELECT us.ussender, s.ssubject, s.scontent, us.ustimesend, us.usstatus,
FROM sporocilo s, uporabnik-sporocilo us , uporabnik u
WHERE ($user LIKE u.uuser) AND (s.SID = us.SID) AND (us.usreciever LIKE u.uuser),
ORDER BY us.ustimesend ASC; 

Database: http://my.jetscreenshot.com/20224/20140415-ls6n-41kb

数据库:http://my.jetscreenshot.com/20224/20140415-ls6n-41kb

2 个解决方案

#1


2  

If your column identifiers are going to contain dashes you must wrap them in ticks. Otherwise MySQL assumes you are performing a subtraction operation.

如果您的列标识符将包含破折号,您必须将它们用刻度包括起来。否则MySQL假设你正在执行减法运算。

SELECT us.ussender, s.ssubject, s.scontent, us.ustimesend, us.usstatus, 
FROM sporocilo s, `uporabnik-sporocilo` us , uporabnik u 
WHERE ($user LIKE u.uuser) AND (s.SID = us.SID) AND (us.usreciever LIKE u.uuser), 
ORDER BY us.ustimesend ASC;

#2


0  

The syntax error is missing quotes, here:

语法错误缺少引号,这里:

WHERE ($user LIKE u.uuser) AND (s.SID = us.SID) AND (us.usreciever LIKE u.uuser), 

plus the comma at the end of that line.

加上这条线后面的逗号。

There are other problems with your query, but that is beyond the scope of your question.

您的查询还有其他问题,但这超出了您的问题范围。

#1


2  

If your column identifiers are going to contain dashes you must wrap them in ticks. Otherwise MySQL assumes you are performing a subtraction operation.

如果您的列标识符将包含破折号,您必须将它们用刻度包括起来。否则MySQL假设你正在执行减法运算。

SELECT us.ussender, s.ssubject, s.scontent, us.ustimesend, us.usstatus, 
FROM sporocilo s, `uporabnik-sporocilo` us , uporabnik u 
WHERE ($user LIKE u.uuser) AND (s.SID = us.SID) AND (us.usreciever LIKE u.uuser), 
ORDER BY us.ustimesend ASC;

#2


0  

The syntax error is missing quotes, here:

语法错误缺少引号,这里:

WHERE ($user LIKE u.uuser) AND (s.SID = us.SID) AND (us.usreciever LIKE u.uuser), 

plus the comma at the end of that line.

加上这条线后面的逗号。

There are other problems with your query, but that is beyond the scope of your question.

您的查询还有其他问题,但这超出了您的问题范围。