You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WITH RECURSIVE tree AS (
SELECT
id,
parent_id,
id AS root_id -- 额外列FROM table
WHERE parent_id IS NULLUNION ALLSELECTt.id,
t.parentId,
p.root_idFROM table t
INNER JOIN tree p ONt.parent_id=p.id
)