X2-3.0 Oracle 获取店铺顶级公司SQL脚本
开发功能时经常有需求需要显示店铺的顶级公司,可以参考以下SQL脚本来查询店铺顶级公司。请按需套用
with parent as (
select connect_by_root department_id as depot_id,
a.department_id as company_id,
a.department_parent_id, level
from d0060 a
start with a.system_type in (10,11)
connect by prior a.department_parent_id = a.department_id
order by level
)
select a.depot_id, b.department_user_id as depot_code, b.department_name as depot_name,
a.company_id, c.department_user_id as company_code, c.department_name as company_name
from parent a inner join v0060 b on a.depot_id=b.department_id and b.language_id='zh-cn'
inner join v0060 c on a.company_id=c.department_id and c.language_id='zh-cn'
where a.department_parent_id=0
没有找到相关结果
已邀请:
1 个回复
雷鸣
赞同来自: