0

I have a column that looks like this

enter image description here

How can I get the min and the max?

Here is the expected value where on the right side is the sorted one

enter image description here

Nardong Bagsik
  • 218
  • 6
  • 20

2 Answers2

1
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

http://sqlfiddle.com/#!9/5f6410/1

Jay Shankar Gupta
  • 5,918
  • 1
  • 10
  • 27
1

To sort the table according to the expected result in the question all you need is:

SELECT latlong 
FROM someTable
ORDER BY latlong ASC
Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52