对不起新手在这里,但我无法让这个查询工作,如果有一个更简单的方法,我会很感激反馈,谢谢。
SELECT players.FirstName, players.LastName, stats.PtsPerGame,
stats.AstPerGame, stats.RebPerGame, stats.StlPerGame, stats.BlkPerGame
WHERE stats.PtsPerGame >= 20
AND stats.AstPerGame >= 3
AND stats.RebPerGame >= 3
AND stats.StlPerGame >= 2
AND stats.BlkPerGame >= 1
From players
INNER JOIN stats
ON players.PlayerID = stats.PID
ORDER BY stats.PtsPerGame DESC;
我收到此错误:
AND stats.AstPerGame> = 3 AND stats.RebPerGame'在第2行
答案 0 :(得分:0)
条件始终显示在from tablename
SELECT players.FirstName, players.LastName, stats.PtsPerGame, stats.AstPerGame, stats.RebPerGame, stats.StlPerGame, stats.BlkPerGame From players INNER JOIN stats ON players.PlayerID = stats.PID WHERE stats.PtsPerGame >= 20 AND stats.AstPerGame >= 3 AND stats.RebPerGame >= 3 AND stats.StlPerGame >= 2 AND stats.BlkPerGame >= 1 ORDER BY stats.PtsPerGame DESC;
答案 1 :(得分:0)
您需要将WHERE
条款降至FROM
和JOIN
像这样:
SELECT players.FirstName,
players.LastName,
stats.PtsPerGame,
stats.AstPerGame,
stats.RebPerGame,
stats.StlPerGame,
stats.BlkPerGame
FROM players
INNER JOIN stats ON players.PlayerID = stats.PID
WHERE stats.PtsPerGame >= 20
AND stats.AstPerGame >= 3
AND stats.RebPerGame >= 3
AND stats.StlPerGame >= 2
AND stats.BlkPerGame >= 1
ORDER BY stats.PtsPerGame DESC;
如果你对这一切都不熟悉,请查看HERE:)