【问题标题】:remove overlapping entries from a table KDB+/Q从表中删除重叠条目 KDB+/Q
【发布时间】:2021-12-28 19:56:40
【问题描述】:

我有两个表,分别称为 table1 和 table2。两者都将日期和 id 作为列,并且 table2 是 table1 条目的一小部分。如何通过匹配更新日期和 id 从 table1 中删除 table2 中存在的所有条目?

【问题讨论】:

    标签: kdb


    【解决方案1】:
    select from table1 where not([]date;id)in table2
    

    【讨论】:

      【解决方案2】:
      / Begin with example input of 10 entries 
      q)t1:([]date:.z.d+til 10;id:til 10;c:til 10)
      / Pick 3 random entries to form key table t2
      q)t2:3?delete c from t1
      / Key t1 by date and id and drop entries matching t2
      q)t2 _ `date`id xkey t1
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-06-27
        相关资源
        最近更新 更多