Hello, i have this dataset
and i want to result in a sort of rank, in which i get the id out of the three that has the highest income, as well as the id, and get the second highest id as well as the respective income. Basically i would like to have this table as a result
I hope i was clear, and thanks in advance for any help you can provide.
MotherID | MIncome | FatherID | FIncome | BossID | SIncome |
m1 | 80,113.37 | f1 | 144,467.20 | f1 | 144,467.20 |
m2 | 140,518.90 | f2 | 139,320.60 | f2 | 139,320.60 |
0.00 | f3 | 9,073.99 | b1 | 240,253.20 | |
0.00 | f4 | 190,642.30 | f4 | 190,642.30 | |
m3 | 74,388.64 | 0.00 | 0.00 | ||
m4 | 74,587.83 | 0.00 | 0.00 | ||
m5 | 93,724.77 | 0.00 | 0.00 | ||
0.00 | f5 | 248,177.80 | f5 | 248,177.80 | |
m6 | 278,946.80 | 0.00 | m6 | 278,946.80 | |
m7 | 65,540.44 | 0.00 | b2 | 70,000.50 | |
m8 | 215,373.70 | 0.00 | m8 | 215,373.70 | |
m9 | 281,698.60 | 0.00 | b3 | 120,000.20 | |
m10 | 207,903.10 | f6 | 270,441.60 | f6 | 270,441.60 |
m11 | 190,504.30 | f7 | 212,657.80 | f7 | 212,657.80 |
m12 | 214,129.70 | 0.00 | 0.00 |
1ID | 1Income | 2ID | 2Income |
f1 | 144,467.20 | m1 | 80,113.37 |
m2 | 140,518.90 | f2 | 139,320.60 |
b1 | 240,253.20 | f3 | 9,073.99 |
f4 | 190,642.30 | ||
m3 | 74,388.64 | ||
m4 | 74,587.83 | ||
m5 | 93,724.77 | ||
f5 | 248,177.80 | ||
m6 | 278,946.80 | ||
b2 | 70,000.50 | m7 | 65,540.44 |
m8 | 215,373.70 | ||
m9 | 281,698.60 | b3 | 120,000.20 |
f6 | 270,441.60 | m10 | 207,903.10 |
f7 | 212,657.80 | m11 | 190,504.30 |
m12 | 214,129.70 |
Comment