本帖最后由 zzxap 于 2012-08-27 20:09:16 编辑

解决方案 »

  1.   


    select * from tablename
    order by power((纬度-@纬度),2)+power((经度-@经度),2)
      

  2.   


    declare @T table([经度] numeric(8,5),[纬度] numeric(7,5))
    insert @T
    select 122.23423,23.23234 union all
    select 123.23678,23.23456 union all
    select 124.43342,34.23232select * from @T
    order by power((纬度-23.23111),2)+power((经度-122.23111),2)
    /*
    经度                             纬度
    ------------------------------ ------------------------------
    122.23423                      23.23234
    123.23678                      23.23456
    124.43342                      34.23232(3 row(s) affected)
    */
      

  3.   

    要支持sql 2000才行,能支持sqlite更好
    目前数据库是sqlite
      

  4.   

    select * from @T  order by (纬度-23.23111)+(经度-122.23111)