db2 with as

WITH
    RPL (org_parent_id, orginfo_id, org_title) AS
    (
        SELECT
            ROOT.org_parent_id,
            ROOT.orginfo_id,
            ROOT.org_title
        FROM
            jt_orgstructtree ROOT
        WHERE
            ROOT.org_parent_id = 'hello'
        UNION ALL
        SELECT
            CHILD.org_parent_id,
            CHILD.orginfo_id,
            CHILD.org_title
        FROM
            RPL PARENT,
            jt_orgstructtree CHILD
        WHERE
            PARENT.orginfo_id = CHILD.org_parent_id
    )
SELECT DISTINCT
    org_parent_id,
    orginfo_id,
    org_title
FROM
    RPL
ORDER BY
    org_parent_id,
    orginfo_id,
    org_title

你可能感兴趣的:(db2)