항목의 모든 조상을 가져오는 SQL 재귀 쿼리 ID parent_id name --------------------- 1 2 first 2 4 second 3 3 third 4 5 fourth 5 - fifth 조상 목록first그래야 한다(2, 4, 5)with name_tree as ( select id, parent_id, name from the_unknown_table where id = 1 -- this is the starting point you want in your recursion union all select c.id, c.parent_id, c.name from the_unknown_table c join name_tree p on p.parent_id = c.id -- this ..