再帰SQL 共通テーブル式を使うことで再帰ができる With cte ( 項目リスト) As ( select 初回のsql Union all select from cte ) Partition by