sql with as 的使用

递归无限级分类查询:

with recursive t as(
select ancestor_org_id,descendant_org_id from v2_organization_tree where ancestor_org_id=215977
union all select k.ancestor_org_id,k.descendant_org_id from v2_organization_tree k,t where t.descendant_org_id=k.ancestor_org_id
) select * from t;

https://blog.csdn.net/pg_hgdb/article/details/80307690

猜你喜欢

转载自www.cnblogs.com/qq1069284034/p/12326431.html