I recently saw this question on #sql and it reminded me of the two or three “SQL riddles” we sent around at the company many years ago:
There is a table called GOALS with the columns PLAYER, GOALS, and GROUP. Write a single SELECT statement that prints the top scorer in every group.
PLAYER GOALS GROUP ---------- ---------- ---------- 1 2 1 1 2 1 2 3 1 2 2 1 2 2 3
Expected result:
PLAYER GOALS GROUP ---------- ---------- ---------- 2 5 1 2 2 3
An answer was posted on #sql, but I really want to figure this out myself, because I *know* I solved this stuff before. 😄
#SQL #Work