ソースコード
with 
    p_1101 as(
        select
            LATITUDE
            ,LONGITUDE
        from 
            LOCATION_TBL
        where DISTRICT_CODE='1101'
        )
    ,sub as(
        select
            LOCATION_TBL.DISTRICT_CODE as DISTRICT_CODE
            ,LOCATION_TBL.LATITUDE as LATITUDE
            ,LOCATION_TBL.LONGITUDE as LONGITUDE
            ,(LOCATION_TBL.LATITUDE-p_1101.LATITUDE)*(LOCATION_TBL.LATITUDE-p_1101.LATITUDE)+
             (LOCATION_TBL.LONGITUDE-p_1101.LONGITUDE)*(LOCATION_TBL.LONGITUDE-p_1101.LONGITUDE)
             as leach
        from LOCATION_TBL
        join p_1101
        )
--select * from sub
    ,sub2 as(
        select
            sub.DISTRICT_CODE as DISTRICT_CODE
            ,sub.LATITUDE as LATITUDE 
            ,sub.LONGITUDE as LONGITUDE
            ,row_number()over(order by leach desc) as row
        from sub
        where DISTRICT_CODE <> '1101'
        )
--select * from sub2
select
    sub2.DISTRICT_CODE as CODE
    ,DISTRICT.DISTRICT_NAME as NAME
    ,sub2.LATITUDE as LAT
    ,sub2.LONGITUDE as LON
    --,row
from 
    sub2
    inner join DISTRICT
    on sub2.DISTRICT_CODE = DISTRICT.DISTRICT_CODE
where sub2.DISTRICT_CODE <> '1101'
order by
    sub2.row asc
    ,CODE asc
提出情報
提出日時2024/12/04 14:26:50
コンテスト第6回 SQLコンテスト
問題位置情報
受験者ZZPBAA79
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量88 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
85 MB
データパターン2
WA
88 MB
データパターン3
AC
88 MB