SELECT
*
FROM
(
SELECT
T1.*,
IF
(
FIND_IN_SET( PARENT_ORGANIZATION_ID, @PIDS ) > 0,
@PIDS := CONCAT( @PIDS, ',', T1.ID ),
0
) AS ISCHILD
FROM
( SELECT A.ID, A.PARENT_ORGANIZATION_ID, A.ORGANIZATION_NAME, A.IS_COMPANY FROM SECURITY_ORGANIZATION A ) AS T1,
( SELECT @PIDS := '0002' COLLATE utf8mb4_unicode_ci ) t2
) t3
WHERE
ISCHILD != 0
网友评论