UPDATE: reformatted the whole question
I have a database with individual results of the Formula 1 race. Each driver receives points for the place in which they end. Now I want to build a table with all the combined points of all the races for each driver. Thus, basically the table is “driver table”.
I can easily get the total points, but the problem that I am encountering occurs when multiple drivers have the same common points. In these cases, I need to check which of the drivers has the best (or more) result of a single race, since it should be higher on the final table.
Oh, and in the placement column “0” means that he didn’t end up with the worst result.
A simple example:
Event | Driver | Placement | Points
--------------------------------------
Race 1 | Driver A | 1 | 3
Race 1 | Driver B | 2 | 2
Race 1 | Driver C | 3 | 1
Race 2 | Driver A | 3 | 3
Race 2 | Driver B | 2 | 2
Race 2 | Driver C | 1 | 1
Race 3 | Driver A | 0 | 0
Race 3 | Driver B | 0 | 0
Race 3 | Driver C | 2 | 2
Driver | Points
------------------
Driver C | 4
Driver A | 4
Driver B | 4
- , Driver C . A , , B . (, , .)
http://sqlfiddle.com/#!9/16f9c5
| Driver | Points |
|------------------------|
| N. Hulkenberg | 43 |
| F. Massa | 43 |
| P. Wehrlein | 5 |
| D. Kvyat | 5 |
| M. Ericsson | 0 |
| P. Gasly | 0 |
| A. Giovinazzi | 0 |
| B. Hartley | 0 |
, . , , , - ( 6- , 2- , ).
:
1. N. Hulkenberg - has four 6th place finishes
2. F. Massa - has two 6th place finishes
3. P. Wehrlein - has 8th place finish
4. D. Kvyat - has 9th place finish
5. M. Ericsson - has 11th place finish
6. P. Gasly - has 12th and 13th place finishes
7. A. Giovinazzi - has only one 12th place finish and nothing else
8. B. Hartley - has 13th place finish
[Hulkenberg vs Massa] [Gasly vs Giovinazzi]
.