我正在尝试通过MySQL数据库上的MTM连接访问多个表。
这是一个示例图,它代表我的表:
我想通过一个Sql-Statement访问User,Skill和SkillLevel。有没有办法使用多个INNER JOIN
'S?
我尝试过这样的事情:
SELECT * FROM User, Skill, SkillLevel
INNER JOIN Members ON User.UserMail = Members.UserMail
INNER JOIN Members ON Skill.SkillID = Members.SkillID
INNER JOIN Members ON SkillLevel.SkillLevelID = Members.SkillLevelID
WHERE Members.TeamID = 123
你能帮助我吗?
修改
我之后设置了表格。只有一个或多个,我总是得到
"Not unique table/alias: 'projectmembers'"
答案 0 :(得分:0)
感谢jarlh我找到了解决方案!诀窍是,通过User,Skill和SkillLevel加入。同样由于Where Statement,我不得不
Select * FROM Members
解决方案是:
SELECT * FROM Members
JOIN User ON Members.UserMail = User.UserMail
JOIN Skill ON Members.SkillID = Skill.SkillID
JOIN SkillLevel ON Members.SkillLevelID = SkillLevel.SkillLevelID
WHERE Members.TeamID = 123 ;