【问题标题】:Delete oldest data with Talend使用 Talend 删除最旧的数据
【发布时间】:2021-06-04 16:52:10
【问题描述】:

我需要删除我在 Talend 数据库中拥有的每个用户的最早地址。我假设数据库中的所有用户都有多个地址。用户必须属于“学生”用户组。 地址在 user_address 表中(包括示例行):

   id   user_id    address_1      address_2     city     country     created_date
    1      1      1 Rosebery Pl                 London      UK        2017-03-12

用户组在 user_group 表中(包括示例行):

   user_id    usergroup
      1        Student

我需要哪些组件?这是我目前所拥有的,但不确定它是否正确。

tFileList ->Iterate -> tFileProperties -> Main -> tUnite -> Main -> tSortRow -> Main -> tSampleRow -> Main -> tFileDelet

【问题讨论】:

  • 您可以按范围“created_date”对表进行分区,然后只需删除不需要的分区或您所说的旧数据

标签: talend


【解决方案1】:

首先使用tDBInput组件以ASC顺序获取数据,将最旧的数据放在最前面:

select id, user_id, address_1, address_2, city, country
from student
order by created_date ASC

Get the First Match record using tMap

The image represents the component mapping to delete the oldest record in address table using tDBOutput

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-13
    • 2021-12-17
    • 2015-07-23
    相关资源
    最近更新 更多