I have been trying to group by by a certain key but the only higher value. for example lets say this is my data
ID KEY Name Value1 Value2
1 52 James 0.5 0
2 52 Amy 0.2 0.1
3 65 Zeus 0.8 0.3
4 65 Chris 0.1 0
So when I do
SELECT * FROM MyTable GROUP BY KEY
The results I get is
ID KEY Name Value1 Value2
2 52 Amy 0.2 0.1
4 65 Chris 0.1 0
The result I want is,
ID KEY Name Value1 Value2
1 52 James 0.5 0
3 65 Zeus 0.8 0.3
I want it to Group by KEY but select the the person with the higher Value1 that belong to the certain KEY. I do not want to use a
WHERE Value1 > 0.4
There are thousand of records and a where statement wouldn't help. I want to know if there is a way to compare Value1 or Value2 between the pertaining KEY and pick the higher value when grouping.
Hope this was clear and thank you in advance. :)