简体   繁体   English

mysql 错误内连接

[英]mysql error inner join

I used a query like我使用了类似的查询

select a.email,b.vuid 
from user a
,inner join group b on a.uid = b.uid 
where a.email='xx@xx.de' and a.kid=1 and b.vid=29 
limit 1

but I always get this error.但我总是收到这个错误。

You have an error in your SQL syntax;您的 SQL 语法有错误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inner join group b on a.uid = b.uid where a.email='xx@xx.de' at line 1检查与您的 MySQL 服务器版本相对应的手册,以了解在第 1 行的“inner join group b on a.uid = b.uid where a.email='xx@xx.de”附近使用的正确语法

I think its because the inner join but I don't know really.. Could someone help me?我认为这是因为内部连接,但我真的不知道..有人可以帮助我吗?

Remove the , after from user a . from user a中删除, after 。

Your query should be:您的查询应该是:

select a.email,b.vuid
from user a
inner join group b
on a.uid = b.uid
where a.email='xx@xx.de'
    and a.kid=1 
    and b.vid=29
limit 1
select a.email,b.vuid from user as a inner join group as b on ...

Of course you can omit the as keyword as demonstrated by @FrustratedWithFormsDesigner but in my opinion it is much more readable this way.当然,您可以省略as关键字,如 @FrustratedWithFormsDesigner 所示,但在我看来,这种方式更具可读性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM