DECLARE @ test_dbcc TABLE (TABLE number VARCHAR (50), the parent GID VARCHAR (50)); WITH DEPT_TREE AS (SELECT table number, parent GID FROM [table] resources _ subject WHERE the parent GID=@ table number UNION ALL SELECT d. table number, d. parent GID FROM chart of _ [resources] d JOIN DEPT_TREE H ON d. parent GID=h. table number) INSERT INTO @ test_dbcc SELECT * FROM DEPT_TREE I should how to write in mysql? 'd better write the detailed point, use a temporary table to finish the result not