I’m working on a problem where I need to determine who the pitcher with the most wins is for each MLB team. I am using derby to do this.
Here is what I have…W is for wins
SELECT one.teamID
FROM Pitching one
Where (one.W >= ALL
(SELECT two.W
FROM Pitching two
Where (two.teamID = one.teamID)
AND (one.playerID < two.playerID)));
This doesn’t produce the correct results. Could someone instruct me on where I went wrong and what a better approach might be? Thank you.
Remove this line:
It accepts players with a higher ID but a lower win rate, which is probably not what you want.