【问题标题】:use DolphinDB to delete rows with matching columns with table join使用 DolphinDB 通过表连接删除具有匹配列的行
【发布时间】:2022-01-13 22:57:24
【问题描述】:

现在我有两个表 t1 和 t2,如屏幕截图所示。 我想选择左侧的 a 和 b 列都与右侧表的行匹配的行。然后在左表中删除它们。 请问是否有任何 DolphinDB 函数可以实现此操作?

【问题讨论】:

    标签: join dolphindb


    【解决方案1】:

    假设这两个表是 t1 和 t2。

    左表为t1,包含a、b、c列;右表是 t2,包含列 a 和 b。

    在 DolphinDB 中有两种方法可以获得所需的输出:

    方法一:

    select t1.*,t2.* from lj(t1, t2, `a`b) where isNull(t2.a)
    

    或方法2:

    s = set(string(t2.a)+string(t2.b))
    select * from t1 where not string(t1.a)+string(t1.b) in s
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-06
      • 1970-01-01
      • 2020-07-06
      • 1970-01-01
      • 2013-12-16
      • 2022-08-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多