I have a column that looks like this
How can I get the min and the max?
Here is the expected value where on the right side is the sorted one
I have a column that looks like this
How can I get the min and the max?
Here is the expected value where on the right side is the sorted one
Select membername From
(Select membername,
substring_index ( membername,',',1)+substring_index ( membername,',',-1) as total
From Table1) T1
Inner Join
(
Select Max(total) total1,Min(total) total2 From (
SELECT membername,
substring_index ( membername,',',1)+substring_index ( membername,',',-1) as total
From Table1)T) T2
ON T1.total=T2.total1
OR T1.total=T2.total2
Live Demo
To sort the table according to the expected result in the question all you need is:
SELECT latlong
FROM someTable
ORDER BY latlong ASC