0

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?

2 Answers 2

4

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
Sign up to request clarification or add additional context in comments.

Comments

2
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.

3 Comments

@Johan Thanks for commenting, could you show me the syntax error?
You have a ',' before 'inner join'
@Johan Thanks, I have already edited it out after I posted the answer. You could remove the downvote if you will.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.