ソースコード
WITH kijun AS (
	SELECT 
		LATITUDE AS kijunLATITUDE
		,LONGITUDE AS kijunLONGITUDE
	FROM LOCATION_TBL
	WHERE DISTRICT_CODE = '1101'
)
,sabun AS (
SELECT 
    t1.DISTRICT_CODE
    ,t3.DISTRICT_NAME
    ,t1.LATITUDE
    ,t1.LONGITUDE
    ,ROUND(ABS(t1.LATITUDE - t2.kijunLATITUDE),7) AS LATITUDEsa
    ,ROUND(ABS(t1.LONGITUDE - t2.kijunLONGITUDE),7) AS LONGITUDEsa
FROM LOCATION_TBL AS t1
CROSS JOIN kijun AS t2
LEFT OUTER JOIN DISTRICT AS t3
	ON t1.DISTRICT_CODE = t3.DISTRICT_CODE
WHERE t1.DISTRICT_CODE <> '1101'
)
,keisan AS (
SELECT
	DISTRICT_CODE
	,DISTRICT_NAME
	,LATITUDE
	,LONGITUDE
	,ROUND(LATITUDEsa * LATITUDEsa,12) AS LATITUDE2
	,ROUND(LONGITUDEsa * LONGITUDEsa,12) AS LONGITUDE2
FROM sabun
)
SELECT
	DISTRICT_CODE AS CODE
	,DISTRICT_NAME AS NAME
	,LATITUDE AS LAT
	,LONGITUDE AS LON
FROM keisan
ORDER BY SQRT(LATITUDE2 + LONGITUDE2) DESC,DISTRICT_CODE ASC
提出情報
提出日時2023/04/17 16:59:50
コンテスト第6回 SQLコンテスト
問題位置情報
受験者katsu
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量86 MB
メッセージ
テストケース(通過数/総数)
2/3
状態
メモリ使用量
データパターン1
AC
82 MB
データパターン2
WA
86 MB
データパターン3
AC
76 MB