SQL 内连接查询
SQL inner-join query
我正在尝试进行内部联接,但我可以让它工作。
这是我的 sql 查询
SELECT highscore.score, bruger.brugerNavn FROM highscore INNER JOIN bruger ON highscore.brugerID ON bruger.brugerID ORDER BY score DESC
我遇到了这个错误
SELECT highscore.score, bruger.brugerNavn FROM highscore INNER JOIN bruger ON highscore.brugerID ON bruger.brugerID LIMIT 0, 25
#1064 - There is an error in the SQL syntax near 'ON bruger.brugerID LIMIT 0, 25' at line 1
如有任何帮助,我将不胜感激:)
SELECT highscore.score, bruger.brugerNavn
FROM highscore
INNER JOIN bruger ON highscore.brugerID = bruger.brugerID
ORDER BY score DESC
你也试试
SELECT highscore.score, bruger.brugerNavn
FROM Highscore as highscore
INNER JOIN Bruger as burger ON highscore.brugerID = bruger.brugerID
ORDER BY highscore.score desc
先试试这个:
SELECT h.score, b.brugerNavn
FROM highscore as h
JOIN bruger as b ON h.brugerID = b.brugerID
我通常添加别名以便于处理。
您需要将 inner join
下的 HS.brugerID on BG.brugerID
替换为 HS.brugerID = BG.brugerID
SELECT HS.score, BG.brugerNavn
FROM highscore as HS
INNER JOIN bruger as BG ON HS.brugerID = BG.brugerID
ORDER BY highscore.score DESC
我正在尝试进行内部联接,但我可以让它工作。 这是我的 sql 查询
SELECT highscore.score, bruger.brugerNavn FROM highscore INNER JOIN bruger ON highscore.brugerID ON bruger.brugerID ORDER BY score DESC
我遇到了这个错误
SELECT highscore.score, bruger.brugerNavn FROM highscore INNER JOIN bruger ON highscore.brugerID ON bruger.brugerID LIMIT 0, 25
#1064 - There is an error in the SQL syntax near 'ON bruger.brugerID LIMIT 0, 25' at line 1
如有任何帮助,我将不胜感激:)
SELECT highscore.score, bruger.brugerNavn
FROM highscore
INNER JOIN bruger ON highscore.brugerID = bruger.brugerID
ORDER BY score DESC
你也试试
SELECT highscore.score, bruger.brugerNavn
FROM Highscore as highscore
INNER JOIN Bruger as burger ON highscore.brugerID = bruger.brugerID
ORDER BY highscore.score desc
先试试这个:
SELECT h.score, b.brugerNavn
FROM highscore as h
JOIN bruger as b ON h.brugerID = b.brugerID
我通常添加别名以便于处理。
您需要将 inner join
下的HS.brugerID on BG.brugerID
替换为 HS.brugerID = BG.brugerID
SELECT HS.score, BG.brugerNavn
FROM highscore as HS
INNER JOIN bruger as BG ON HS.brugerID = BG.brugerID
ORDER BY highscore.score DESC