【CQ】如何查询duplicate类型的上下游数据

转载自IBM网站,有时候会用到
先是SQL查询的:
To create a query which returns Duplicate parent and child information in the result set:
  1. Create a new query.
  2. Select the ID field to display and select no filter fields. Run the query.
  3. Select the 'SQL editor' tab next to the 'Display editor' tab.
    Note: If you cannot see the 'SQL editor' tab, select View > View SQL pane from the menu. Then the SQL editor tab will become available.
  4. Make a change to the SQL command in the SQL editor tab. You will be prompted to confirm to continue.
  5. Select Yes and the SQL command will become editable.
  6. Replace the SQL command in the tab with the following SQL command using 'Ctrl + V' to paste it.
    1. To show all the records in duplicate state and include their parent IDs in the result set:

      select distinct T1.dbid, T1.id, T2.id as "Duplicate Of" 
      from Defect T1, Defect T2, parent_child_links l 
      where T1.dbid <> 0 and (T1.dbid = l.child_dbid 
      and l.parent_dbid = T2.dbid and l.link_type_enum=2)
    2. To show all the records which have duplicate records and include their duplicate IDs in the result set :

      select distinct T1.dbid, T1.id, T2.id as "Duplicates" 
      from Defect T1, Defect T2, parent_child_links l 
      where T1.dbid <> 0 and (l.parent_dbid = T1.dbid 
      and l.child_dbid = T2.dbid and l.link_type_enum=2)
  7. Run the Query
程序方法获取,提供方法,可自己查看api说明
GetOriginal  获取父记录对象
GetOriginalID 获取父记录ID
GetDuplicates 获取子记录集合
IsOriginal 是否父记录类型
IsDuplicate 是否子记录类型

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值