我正在使用Sean Lahman数据库并使用mysql(phpmyadmin)。我编写了下面的查询,但我得到“MySQL返回一个空结果集”。我想知道2002年每次最低胜利的成本。我不知道我的错误在哪里。请帮忙。 所以你知道我是sql的新手,我的母语不是英语。 : - )
SELECT teams.name,
(ROUND(SUM(salaries.salary), 0))/teams.W AS costperwin
FROM salaries
JOIN teams ON salaries.teamID=teams.teamID
WHERE salaries.yearID='2002'
AND teams.yearID='2002'
GROUP BY salaries.teamID
HAVING costperwin =
(SELECT MIN(bb)
FROM
(SELECT (ROUND(SUM(salaries.salary), 0))/teams.W AS bb
FROM salaries
JOIN teams ON salaries.teamID=teams.teamID
WHERE salaries.yearID='2002'
AND teams.yearID='2002'
GROUP BY salaries.teamID) AS ALIAS)