2016-08-03 102 views
0

我如何保留錯誤1248(42000):每個派生表都必須有自己的別名?我已經給每個表都有自己的別名,不是嗎?抱歉,我不太確定我在這裏做錯了什麼,因爲我在MySQL的第一個學期。錯誤1248(42000):每個派生表都必須有自己的別名

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; 
+1

')ON = s.GameID g.GameID'應成爲')爲g ON s.GameID = g.GameID' –

+0

在錯誤_derived_表中指的是你的子查詢。 – Uueerdo

+0

它很有趣。我首先寫了答案,並且接受被授予其他人。 – FallAndLearn

回答

0

你缺少對左外後右內部查詢別名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; 
+0

它很有趣。我先寫了答案,然後你就接受了。 – FallAndLearn

+0

@FallAnd學會從我那裏得到讚揚 –

+0

謝謝。讚賞。 – FallAndLearn

1

您的子查詢下面應該有一個別名。

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