Roby
Roby

Reputation: 2061

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='[email protected]' and a.kid=1 and b.vid=29 
limit 1

but I always get this error.

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 'inner join group b on a.uid = b.uid where a.email='[email protected]' at line 1

I think its because the inner join but I don't know really.. Could someone help me?

Upvotes: 0

Views: 118

Answers (2)

Remove the , after from user a.

Your query should be:

select a.email,b.vuid
from user a
inner join group b
on a.uid = b.uid
where a.email='[email protected]'
    and a.kid=1 
    and b.vid=29
limit 1

Upvotes: 4

kapa
kapa

Reputation: 78751

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.

Upvotes: 2

Related Questions