I am looking for a way to select a single row from a MySQL table.
One of the columns contains a hexidecimal value and I only want to SELECT the row which contains the largest hex value.
So for instance there are three rows like:
id hex_value comments
1 01 some comments...
2 1A some comments...
3 03 some comments...
So the resultant returned rows contents would be id 2 as the value 1A is the greatest.
If anyone could point me in the right direction it would be most appreciated.
Thank you
Mark
As long as the hexadecimal strings are the same length (as in your example), they are comparable as strings, so you can just sort them:
Note: You need to use
descwhen sorting to get the highest value first.