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