Newbie question about selecting a single data entry
Posted 30 August 2006 - 03:48 PM
Here's the situation: I'm using a baseball database and am working with a single table called Batting. What I'd like to do is display the playerID and RBI columns for the player with the most RBIs in the 2005 (yearID). I've tried combinations of max(RBI) and playerID, but then I have to use a GROUP BY clause, which displays more than I want.
So I'm hoping someone can help me. This seems like a very basic thing to do, but I'm having trouble working with a 'normal' column like playerID and an aggregate like max(RBI).
Posted 30 August 2006 - 03:54 PM
SELECT playerID, RBI from Batting WHERE yearID = '2005' ORDER by RBI DESC LIMIT 1
Hmm, interesting! I guess I was on the wrong track with max(RBI). Thanks!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users