1表结构
oid、pid为父子结构
2 代码
点击查看代码
WITH RECURSIVE f as (
SELECT * FROM wg_formula WHERE oid = 1
UNION all
SELECT wg_formula.* FROM wg_formula,f where wg_formula.pid = f.oid
-- SELECT wg_formula.* FROM wg_formula join f on wg_formula.pid = f.oid 和上方同效果
)
SELECT * from f ORDER BY oid