Skip to content

[Feature] asTreeCte支持额外列 #479

Description

@rocascent
WITH RECURSIVE tree AS (
    SELECT 
        id, 
        parent_id, 
        id AS root_id   -- 额外列
    FROM table
    WHERE parent_id IS NULL

    UNION ALL

    SELECT 
        t.id, 
        t.parentId, 
        p.root_id
    FROM table t
    INNER JOIN tree p ON t.parent_id = p.id
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions