I've the following tables:
permissions
user_permissions
users
When trying to run the following query:
SELECT * FROM users as u
LEFT JOIN user_permissions AS up ON u.id = up.id_user
LEFT JOIN permissions AS p ON up.id_permission = p.id
I'm getting the following error:
What I'm missing?
CodePudding user response:
Here is the correct query:
SELECT * FROM users INNER JOIN (permissions INNER JOIN user_permissions ON permissions.id = user_permissions.id_permission) ON users.id = user_permissions.id_user WHERE (((users.username)='admin'));
According to @June 7 comment:
Access SQL is picky about parentheses for JOIN clauses (they are missing in your SQL). Use the query DesignView to get correct structure then switch to SQLView. The table aliases are not necessary