Hello
I’ve made a basic fiddle: http://sqlfiddle.com/#!9/1da0f3/13 for testing purposes. I have this output which is perfect:
| buyer | vendor | percentage |
|---|---|---|
| 1 | 2 | 5 |
| 1 | 3 | 3 |
| 1 | 4 | 2 |
| 2 | 3 | 2 |
| 2 | 4 | 1 |
| 2 | 8 | 4 |
| 3 | 1 | 6 |
However I need to get the highest ‘percentage’ for each ‘buyer’. I’ve tried using MAX() and a variety of other syntax. This is the output I need:
| buyer | vendor | percentage |
|---|---|---|
| 1 | 2 | 5 |
| 2 | 8 | 4 |
| 3 | 1 | 6 |
(5 was the highest percentage for buyer 1, 4 was the highest percentage for buyer 2, 6 was the highest (only) percentage for buyer 3.
Can someone point me in the right direction please?


