mysql 有with recursive么

2024-12-09 16:34:50
推荐回答(1个)
回答1:

查询empid=2下的所有记录
WITH RECURSIVE r AS (
SELECT * FROM emp WHERE empid = 2
union ALL
SELECT emp.* FROM emp, r WHERE emp.empparid = r.empid
)