0

I have table areas with column id, name, position. The column position is of POINT type and stores (latitude, longitude) of the place.

I read a solution to find nearest places using point datatype and st_distance_sphere in MySQL here. But when I run following query in mysql workbench, i get message: OK. I want to see all the rows that match this criteria.

select
    id,name,
    st_distance_sphere(`position`, st_geomfromtext('Point(77.058210 28.632955)', 4326)) as distance
from areas
order by distance asc;
Sahil Sharma
  • 3,847
  • 6
  • 48
  • 98
  • Please reference where you found this so we can look at your base information that should include SHOW CREATE TABLE xxxx. – Wilson Hauck Jul 03 '18 at 11:12

1 Answers1

1

You may need to check how you construct POINT. POINT constructor has longitude as first parameter.

POINT(longitude, latitude)

If you have it reversed then you won't get any result since it can't be calculated. However the query itself is not wrong hence the return message OK.

inmyth
  • 8,880
  • 4
  • 47
  • 52