错误1248(42000):每个派生表必须有自己的别名

时间:2016-08-03 20:22:02

标签: mysql

为什么我保留错误1248(42000):每个派生表必须有自己的别名?我给了每张桌子它自己的别名天堂我不是吗?对不起我不太确定我在这里做错了什么,因为我在MySQL的第一个学期。

SELECT p.PlayerAlias as "Player", 
       s.HiScore as "Score" 
  FROM Player as p INNER JOIN Score as s ON p.PlayerID = s.PlayerID 
       LEFT OUTER JOIN (
           SELECT g.GameID 
             FROM Game as g 
            WHERE g.GameName = "Reaper"
       ) ON s.GameID = g.GameID 
 WHERE s.HiScore < 7000 AND s.HiScore > 4000;

2 个答案:

答案 0 :(得分:1)

下面的子查询应该有一个别名。

LEFT OUTER JOIN (
           SELECT g.GameID 
             FROM Game as g 
            WHERE g.GameName = "Reaper"
       ) AS T

答案 1 :(得分:0)

在LEFT OUTER JOIN之后,您在内部查询中缺少别名

SELECT p.PlayerAlias as "Player", 
       s.HiScore as "Score" 
  FROM Player as p INNER JOIN Score as s ON p.PlayerID = s.PlayerID 
       LEFT OUTER JOIN (
           SELECT g.GameID 
             FROM Game as g 
            WHERE g.GameName = "Reaper"
       ) as g ON s.GameID = g.GameID 
 WHERE s.HiScore < 7000 AND s.HiScore > 4000;