【问题标题】:Documentum DQL join by repeating attributeDocumentum DQL 通过重复属性连接
【发布时间】:2018-08-31 10:11:10
【问题描述】:

我尝试使用重复属性加入这些表格:

table1

r_object_id           codes
...                   1,2,3,4,5
...                   7,6,3,4,5
...                   1,5,4,2,3

其中codes 属性是重复属性。

table2

r_object_id      name      code
...              hello      1
...              aba        2
...              father     3
...              mother     4
...              hello2     5
...              hello3     6
...              hello4     7

我想要这样的结果:

table1.r_object_id      names
...                     hello,aba,father,mother,hello2

我能做什么?

【问题讨论】:

    标签: repeat documentum documentum-dql


    【解决方案1】:

    这在一个 DQL 查询中是不可能的。但是你有一些选择如何解决它。

    1) 使用一个 DQL,但每一个重复值对应一行:

    SELECT DISTINCT t1.r_object_id, t2.name FROM table1 t1, table2 t2 WHERE t1.codes = t2.code ENABLE(ROW_BASED)
    

    结果会是这样的:

    r_object_id      name
    0900ad1234567890 hello
    0900ad1234567890 aba
    0900ad1234567890 father
    0900ad1234567890 mother
    0900ad1234567890 hello2
    0900ad1234567891 father
    0900ad1234567891 mother
    ...
    

    2) 在应用程序中配对值 - 例如使用 Java。通过一次查询从 table2 中选择所有记录并将它们存储到Map<String, String> codeTable,其中code 属性作为键,name 属性作为值。然后通过另一个查询从 table1 中选择记录,并将重复属性 (codes) 中的值与 codeTable 映射中的值配对。

    【讨论】:

      猜你喜欢
      • 2015-03-05
      • 2011-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-02
      相关资源
      最近更新 更多