【发布时间】:2014-04-04 06:06:12
【问题描述】:
我有一张具有父/子关系的表。如何找到失踪的父母?
层次表:
child parent
2000698835 2001455376
如果客户表中不存在父级,我需要插入它。在这里我如何在客户表中找到丢失的父级?
select * from customer where true_gcdb_source_key='2001455376'(which is the parent)
查询所有孩子的父母 从 sap_cust_rel_init 中选择 * 从 child_gcdb_id='2002615591' 开始 通过 child_gcdb_id=prior parent_gcdb_id 连接
child_gcdb_id parent_gcdb_id
2002615591 2002554170
2002554170 2002554286
2002554286 2002554081
2002554081
2002554081
2002554081
2002554286 2002554081
2002554081
2002554081
2002554081
2002554286 2002554081
2002554081
2002554081
2002554081
2002554170 2002554286
2002554286 2002554081
2002554081
2002554081
2002554081
2002554286 2002554081
2002554081
2002554081
2002554081
2002554286 2002554081
2002554081
2002554081
2002554081
2002554170 2002554286
2002554286 2002554081
2002554081
2002554081
2002554081
2002554286 2002554081
2002554081
2002554081
2002554081
2002554286 2002554081
这用于获取该孩子的所有父母
如果客户表中不存在任何父母,我需要插入它们
【问题讨论】:
-
请详细说明您真正需要什么