I am learning SQL, and I am trying to get a job. I have the following table in MS SQL Server 2014:
The table is called Game with the following fields: Name, Stage #, Score.
My goal is to write the winner of each stage with his/her name (winner of the stage is the person who earned the maximum score).
Here is the original table:
Name Stage # Score George A 10 Joe A 10 Pete A 9 Jane B 7 Sally B 6
Here is what the output should look like:
Winner Name Score Stage George 10 A Joe 10 A Jane 7 B
How can I accomplish this task? A colleague referred me to http://sqlfiddle.com/ to help me figure this out, but this website is apparently not working well for MS SQL Server 2014 or MS SQL Server 2008. Therefore, can I receive some assistance here?
I understand some of the basic functions, such as SELECT, WHERE, GROUP BY, JOIN, and HAVING, but I am having trouble putting it all together to get the correct three-line output that I desire above.