Valckef
Valckef

Reputation: 63

What is wrong with this MySQL command?

The query that is throwing an error for my MySQL DB is:

SELECT t1.GROUPNAME FROM user_group t0, group t1 WHERE ((t0.users_USERNAME = 
?) AND (t1.GROUPNAME = t0.groups_GROUPNAME))

The error info is the following:

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 'group t1 WHERE 
((t0.users_USERNAME = 'test') AND (t1.GROUPNAME = t0.groups_GROUP')

Okay so I know the problem is with the group t1 part. But I dont know what is wrong with it.

Click here to see that I have all the needed colums

Can any one find out what the problem could be here?

Upvotes: 0

Views: 46

Answers (1)

user8558216
user8558216

Reputation:

group is a reserved word in SQL. You should put quotes around it. Some JPA providers do that automatically, whereas others don't ...

Upvotes: 3

Related Questions