本文介绍了加入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个mysql连接问题,这对我来说总是有点复杂



我使用mysql 4.0.25版标准。


这是我的SQL语句,用于检查用户#1是否有权登录




SELECT用户。*,权利。* FROM用户

LEFT JOIN join_users_rights ON users.id = join_users_rights.user

LEFT JOIN权利ON join_users_rights.right = rights.id

WHERE((rights.name =''login'')AND(users.id =''1''))


这是我收到的错误消息:

#1064 - 您的SQL语法有错误。检查

对应于您的MySQL服务器版本的手册,使用正确的语法

附近

''right = rights。 id WHERE((rights.name =''login'')AND(u


我哪里出错?


提前致谢,


Sjoerd Mulder

Hi,

I have a problem with mysql joins, which are always a bit complicated
to me.
I use mysql version 4.0.25-standard.

This is my SQLstatement, used to check if user #1 has the right to
login:

SELECT users.*, rights.* FROM users
LEFT JOIN join_users_rights ON users.id=join_users_rights.user
LEFT JOIN rights ON join_users_rights.right=rights.id
WHERE ((rights.name=''login'') AND (users.id=''1''))

And this is the error message I get:
#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
''right = rights . id WHERE ( ( rights . name = ''login'' ) AND ( u

Where do I go wrong?

Thanks in advance,

Sjoerd Mulder

推荐答案




请参阅权利。 id" ;?那应该是rights.id。相同的

" rights.name"。



See the "rights . id"? That should propably be rights.id. Same for
"rights . name".









这篇关于加入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 23:40