select p.*,st_distance (
point (p.longitude, p.latitude ), point (:lng,:lat)
) * 111195 AS dist
from product p order by dist
按照距离排序商品距离,通过数据距离函数计算。高版本支持次函数。dist 计算出来单位为米。
select p.*,st_distance (
point (p.longitude, p.latitude ), point (:lng,:lat)
) * 111195 AS dist
from product p order by dist
按照距离排序商品距离,通过数据距离函数计算。高版本支持次函数。dist 计算出来单位为米。