ソースコード
WITH SUB1 AS(
    SELECT
        LATITUDE
        ,LONGITUDE
    FROM
        LOCATION_TBL
    WHERE
        DISTRICT_CODE = '1101'
), DISTANCE_TBL AS(
    SELECT
        DISTRICT_CODE
        ,LOCATION_TBL.LATITUDE
        ,LOCATION_TBL.LONGITUDE
        ,(SUB1.LATITUDE - LOCATION_TBL.LATITUDE) * (SUB1.LATITUDE - LOCATION_TBL.LATITUDE) +
        (SUB1.LONGITUDE - LOCATION_TBL.LONGITUDE) * (SUB1.LONGITUDE - LOCATION_TBL.LONGITUDE) AS DISTANCE
    FROM
        LOCATION_TBL
            CROSS JOIN SUB1
)
SELECT
    DISTANCE.DISTRICT_CODE AS CODE
    ,DISTRICT.DISTRICT_NAME AS NAME
    ,DISTANCE.LATITUDE AS LAT
    ,DISTANCE.LONGITUDE AS LON
FROM
    DISTANCE_TBL AS DISTANCE
        LEFT OUTER JOIN DISTRICT
            ON DISTANCE.DISTRICT_CODE = DISTRICT.DISTRICT_CODE
WHERE
    DISTANCE.DISTRICT_CODE <> '1101'
ORDER BY
    DISTANCE.DISTANCE DESC
    ,DISTANCE.DISTRICT_CODE ASC
        
提出情報
提出日時2024/03/11 17:40:02
コンテスト第6回 SQLコンテスト
問題位置情報
受験者citrus_sudachi
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量84 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
82 MB
データパターン2
WA
84 MB
データパターン3
AC
84 MB