当前位置:Gxlcms > 数据库问题 > postgreSQL ltree工具获取上下级

postgreSQL ltree工具获取上下级

时间:2021-07-01 10:21:17 帮助过:43人阅读

* from departments

技术分享

/*
  
查询子级部门 path <@ ‘‘ 查询上级部门 path @>
  path: 部门id用‘.‘连接
*/
select
id,name,path,parent_id from departments where path <@ cast(NE*********Pc.NE*********Pd.NE*********Ra as ltree)

技术分享

 

postgreSQL ltree工具获取上下级

标签:pre   postgre   ges   rtm   .com   art   logs   pat   images   

人气教程排行