解答

211

SQL文(クエリ)

SELECT
  prefecture
  , MAX(most_elder) AS most_elder_customer
FROM
  (
    SELECT
      prefecture
      , FIRST_VALUE(name) 
    OVER (PARTITION BY prefecture ORDER BY birthday)
    AS most_elder
    FROM
      sample.customers
    WHERE
      prefecture IN ("東京", "大阪", "京都")
  )
GROUP BY
  prefecture

結果テーブル

結果テーブル

サポートページに戻る