sql server 2005中使用with实现递归
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