This is my query which attempts to return the distance from a specific point to all the records in a table.
This is the Table creation
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fname` varchar(45) DEFAULT NULL,
`lname` varchar(45) DEFAULT NULL,
`location` point DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=latin1;
This is the select statement.
`SELECT ST_Distance_Sphere(POINT(-79.3716, 43.6319), location) as distance from user;`
But it produces the following error:
'Error', '1210', 'Incorrect arguments to st_distance_sphere'
How do I get the calculated distance along with data using the point type stored in the database.
This statement works perfectly
SELECT ST_Distance_Sphere(POINT(-79.3716, 43.6319), POINT(-79.3716, 45.6319)) as distance FROM user;
Ensure that the POINT variable stored in the database are in correct order