select
address 地址,
county 区,
entertype 类型,
round( sdo_geom.sdo_distance(
sdo_geometry(2001,null,sdo_point_type(t_x,t_y,null),null,null),
sdo_geometry(2001,null,sdo_point_type(t1_x,t1_y,null),null,null),--sdo_geom.sdo_distance函数
0.001),5)*1000 相差距离
from (<pre name="code" class="sql">select t.lnglat.sdo_point.x t_x,t.lnglat.sdo_point.y t_y,
t1.bd_lng t1_x,t1.bd_lat t1_y,
t.address address,
t2.county county ,
t2.entertype entertype
from T_GIS_LNGLATLOG_SHANGHAI t
join t_address_formal t2 on
t.address=t2.address
join t_cordinate_baidu t1 on
t2.address_no=t1.id
)
order by 相差距离