Table:
Name | Value | Prize
Race1 32 5
Race1 22 5
Race1 30 5
Race2 11 5
Race2 12 5
Race2 31 5
What I want to query, When I define a Value 20+, The UNIQUE races (Race1, Race2) will be selected to my result, based on whose Value is higher. And prize should be summed.
So when I do metaquery : select sum(Prize) biggestValueUniqueRaces where value > -20
I get:
Query returns :
Prize
10
Where it took into consideration these 2 rows :
Name | Value | Prize
Race1 32 5
Race2 31 5
Edit re comment
Or