Reputation: 2061
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
Reputation: 27536
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
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