復制代碼 代碼如下:
WITH fw_requestion_note_temp(old_apply_id) AS ( --取根節點放入臨時表
SELECT old_apply_id FROM fw_requestion_note --WHERE old_apply_id = 'e741470e-8b5c-4f91-9b03-c7474d103aef'
--根據已取到的數據遞歸取其字節點的數據
UNION ALL SELECT fw.old_apply_id FROM fw_requestion_note fw
INNER JOIN fw_requestion_note_temp temp ON fw.apply_id = temp.old_apply_id ) SELECT old_apply_id FROM fw_requestion_note_temp