後,我將不勝感激一些幫助,下面SQL errror增加額外的選擇
SELECT distinct playerid as le_player,
(select sum(score) from playerresults where playerid = le_player) as wins,
(select handicap from players where playerid = le_player) as handicap, playername,
(select count(playerid)*3 from playerresults where playerid = le_player)as totalgames,
(select count(playerid)*3 from playerresults where playerid = le_player) - (select sum(score) from playerresults where playerid = le_player)as lost,
round((select sum(score) from playerresults where playerid = le_player)/(select count(playerid)*3 from playerresults where playerid = le_player) * 100,2) as percent,
teams.team_name
FROM playerresults
INNER JOIN teams on (select players.team_id from players where players.id = playerid) = teams.id
WHERE playerresults.season = 2012 AND playerresults.league = 4
ORDER BY wins desc,totalgames asc
這是工作,直到我說下面一行:
(select handicap from players where playerid = le_player) as handicap
現在,這產生了Subquery returns more than 1 row
錯誤。
障礙是一個新的領域添加到我的球員表,所以我想我可以只添加這一點的SQL到我的原始。
有什麼想法?
感謝 DG
@juergend你認爲你可以幫助他們嗎? –