ソースコード
WITH cte AS (
  SELECT
    L1.DISTRICT_CODE AS CODE,
    L1.LATITUDE AS LAT,
    L1.LONGITUDE AS LON,
    L2.LATITUDE AS NEXT_LAT,
    L2.LONGITUDE AS NEXT_LON,
    (
      (L2.LATITUDE - L1.LATITUDE) * (L2.LATITUDE - L1.LATITUDE) +
      (L2.LONGITUDE - L1.LONGITUDE) * (L2.LONGITUDE - L1.LONGITUDE)
    ) AS DISTANCE_SQ
  FROM
    LOCATION_TBL AS L1
    JOIN LOCATION_TBL AS L2 ON L1.DISTRICT_CODE < L2.DISTRICT_CODE
  WHERE
    L1.DISTRICT_CODE = '1101'
)
SELECT
  D.DISTRICT_CODE AS CODE,
  D.DISTRICT_NAME AS NAME,
  D.LATITUDE AS LAT,
  D.LONGITUDE AS LON
FROM
  DISTRICT AS D
  JOIN cte ON D.DISTRICT_CODE = cte.CODE
WHERE
  cte.DISTANCE_SQ IS NOT NULL
ORDER BY
  cte.DISTANCE_SQ DESC,
  D.DISTRICT_CODE ASC;
提出情報
提出日時2023/07/11 15:45:51
コンテスト第6回 SQLコンテスト
問題位置情報
受験者inuinu
状態 (詳細)RE
(Runtime Error: 実行時エラー)
メモリ使用量81 MB
メッセージ
SQLITE_ERROR: no such column: D.LATITUDE
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
RE
80 MB
データパターン2
RE
78 MB
データパターン3
RE
81 MB