ソースコード
with base_point as (
    --基準地点
    select
        LATITUDE as base_LA
        ,LONGITUDE as base_LO
    from
        LOCATION_TBL
    where
        DISTRICT_CODE = '1101'
    ),
    
    distance_list as (
    select
        l.DISTRICT_CODE as CODE
--        ,d.DISTRICT_NAME as NAME
        ,l.LATITUDE as LAT
        ,l.LONGITUDE as LON
--        ,abs(l.LATITUDE - base_LA) + abs(l.LONGITUDE - base_LO) as distance
        ,sqrt(POW((l.LATITUDE - base_LA),2) + POW((l.LONGITUDE - base_LO),2)) as distance
    from
        LOCATION_TBL l
        ,base_point
--        left join DISTRICT d on l.DISTRICT_CODE = d.DISTRICT_CODE
    where
--        l.PF_CODE = '01000'
         l.DISTRICT_CODE <> '1101'
    )
select
    CODE as CODE
    ,d.DISTRICT_NAME as NAME
    ,LAT as LAT
    ,LON as LON
--    ,distance
from distance_list l
left join DISTRICT d on l.CODE = d.DISTRICT_CODE
order by distance desc
        ,CODE asc
;
提出情報
提出日時2023/04/17 00:20:28
コンテスト第6回 SQLコンテスト
問題位置情報
受験者keisuke_nakata
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量99 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
95 MB
データパターン2
WA
89 MB
データパターン3
AC
99 MB