34,590
社区成员
发帖
与我相关
我的任务
分享
create table tb1(name varchar(10),lng numeric(18,6),dmn numeric(18,6))
insert into tb1 select '桂东沙田', 113.807, 25.83 union
select '桂东广电', 110.933, 26.0564
create table tb2(name varchar(10),lng numeric(18,6),dmn numeric(18,6))
insert into tb2
select '径口',113.80257,25.822257 union
select '横屋',113.803948,25.820615 union
select '云岭',113.80613,25.821791 union
select '石桥镇',112.402757,25.736888 union
select '肖家镇',112.475639,25.69247 union
select '普满乡',112.516254,25.694456
select * from tb1 a,tb2 b where
b.name in(select top 10 name from tb2 order by
100*ROUND(SQRT(POWER((a.lng-lng),2)+POWER((a.dmn-dmn),2)),6) desc)
select a.name n,b.name ,POWER((a.lng-b.lng),2)+POWER((a.dmn-b.dmn),2) juli into #jltemp
from piloting_bts a , piloting_all b
select n,name,juli into #j from #jltemp where juli<0.01/*缩小点数据量,这个出来也有200w条记录*/
select a.name,b.name
from piloting_bts a,#j b
where b.name in
(select top 10 b.name from #j order by
juli desc)