ソースコード
with TBL as (
    select * from LOCATION_TBL
    where DISTRICT_CODE  = '1101'
    )
select 
  c.DISTRICT_CODE as CODE
  ,e.DISTRICT_NAME as NAME
  , c.LATITUDE as LAT
  , c.LONGITUDE as LON
from 
    LOCATION_TBL c
inner join 
    (
        select
          a.*
          , ( 
            6371 * ACOS( 
              COS(RADIANS(b.LATITUDE)) * COS(RADIANS(a.LATITUDE))
              * COS(RADIANS(a.LONGITUDE) - RADIANS(b.LONGITUDE))
               + SIN(RADIANS(b.LATITUDE)) * SIN(RADIANS(a.LATITUDE))
            )
          ) as DISTANCE 
        from
            LOCATION_TBL a
        cross join TBL b
    ) d
    on c.PF_CODE = d.PF_CODE 
    and c.DISTRICT_CODE = d.DISTRICT_CODE 
inner join DISTRICT e
    on c.DISTRICT_CODE  = e.DISTRICT_CODE 
where c.DISTRICT_CODE  != '1101'
order by
    DISTANCE desc
    ,c.DISTRICT_CODE
提出情報
提出日時2023/04/16 15:44:22
コンテスト第6回 SQLコンテスト
問題位置情報
受験者sato
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/3
状態
メモリ使用量
データパターン1
WA
77 MB
データパターン2
WA
85 MB
データパターン3
WA
77 MB