如果同一ID的所有记录在另一个表中删除,则根据一个表中的ID删除记录

发布于 2025-01-22 12:41:43 字数 159 浏览 3 评论 0原文

请帮助我逻辑。 我有两张客户和交易表,并且有列操作i,u,D。如果列是我或u删除数据,则在交易表中删除数据。如果删除了同一事务ID的所有记录删除客户记录else else删除可以进行插入,UPSERT,使用更新策略在交易表中删除的交易记录

,但是如果删除相同的交易ID,我们如何删除客户记录

pls help me with logic.
I have two tables of customers and transactions and there is column action I, U, D. If column action is I or U upsert the data if it is D delete the data in transactions tables.If all records of same transaction id are deleted then delete customers record else delete the transactions record

We can do insert,upsert,delete using Update strategy in transaction table but how can we delete the customer record if the same transaction IDs deleted

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

呆° 2025-01-29 12:41:43

您需要创建一个逻辑(如您说的那样)才能从客户表中删除。并且更安全地在同一映射或全新的映射中创建新管道。

因此,您将从客户中读取Customer_key,查找交易表(在Customer_key上的条件),如果您发现没有找到行,请删除该客户。

  1. 从客户表中读取所有customer_key。
  2. 在Customer_key上查找交易表。返回customer_key。
  3. 使用更新策略,从sq#1链接customer_key和查找中的customer_key。创建这样的条件
    iif(lkp_customer_key是null,dd_delete)
  4. link customer_key从sq#1到客户目标。

您也可以在源预选赛中使用左加入来执行此操作。

You need to create a logic ( like you said ) to delete from customer table. And its safer to either create a new pipeline in same mapping or a brand new mapping.

So, you will read customer_key from customer, do a lookup into transaction table(condition on customer_key), if you see no row found, delete that customer.

  1. Read all customer_key from customer table.
  2. Lookup on transaction table on customer_key. return customer_key.
  3. Use update strategy, link customer_key from SQ #1 and customer_key from lookup. create a condition like this
    IIF ( lkp_customer_key is null, DD_DELETE)
  4. Link customer_key from SQ #1 to the customer target.

You can do this using left join too in source qualifier as well.

歌枕肩 2025-01-29 12:41:43

DELETE上的大多数数据库服务器,它都会级联在各个表上的更新

most of database servers on delete, it cascade the update on respective tables

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文