I have a MySQL DB that looks kind of like this...
id Color Length Width map_price other_fields, etc...
------ ----- ----- ----- ----- -----
1 Red 2'3" 2'6" 125.0000 ...etc
2 Red 10'6" 12' 200.0000 ...etc
3 Red 12' 14' 300.0000 ...etc
4 Blue 3' 5' 135.0000 ...etc
5 Blue 5'8" 7'6" 160.0000 ...etc
6 Green 2'5" 3' 115.0000 ...etc
7 Yellow 9'2" 10' 200.0000 ...etc
I am attempting to construct a query to
- GROUP BY Color
- AND "use the highest values (determined by map_price)" to represent the group.
At the moment, when I GROUP BY Color - the LOWEST value in the fields seem to be defaulted to (or it could just be the lower ID #, although I can't reliably say id 2 > id 1 for my purposes). For example...
Color Length Width map_price other_fields, etc...
------ ------ ----- --------- -----
Red 2'3" 2'6" 125.0000 ...etc
Blue 3' 5' 135.0000 ...etc
Green 2'5" 3' 115.0000 ...etc
Yellow 9'2 10' 200.0000 ...etc
And what I'm after is actually...
Color Length Width map_price other_fields, etc...
------ ------ ----- --------- -----
Red 12' 14' 300.0000 ...etc
Blue 5'8" 7'6" 160.0000 ...etc
Green 2'5" 3' 115.0000 ...etc
Yellow 9'2 10' 200.0000 ...etc
The problem is this is the most concise way I can think of to articulate what I'm after, so unfortunately google, etc... has done me no good. I just need a finger in the right direction.