Posted By

tmmyy on 04/01/11


Tagged


Versions (?)

SQL Distance


 / Published in: SQL
 

  1. DELIMITER $$
  2.  
  3. DROP FUNCTION IF EXISTS `geotest`.`distance` $$
  4. CREATE FUNCTION `distance`(a POINT, b POINT) RETURNS double
  5. DETERMINISTIC
  6. COMMENT 'distance function'
  7. BEGIN
  8. RETURN round(glength(linestringfromwkb(linestring(a, b))));
  9. END $$
  10.  
  11. DELIMITER ;

Report this snippet  

You need to login to post a comment.