【发布时间】:2021-12-28 19:56:40
【问题描述】:
我有两个表,分别称为 table1 和 table2。两者都将日期和 id 作为列,并且 table2 是 table1 条目的一小部分。如何通过匹配更新日期和 id 从 table1 中删除 table2 中存在的所有条目?
【问题讨论】:
标签: kdb
我有两个表,分别称为 table1 和 table2。两者都将日期和 id 作为列,并且 table2 是 table1 条目的一小部分。如何通过匹配更新日期和 id 从 table1 中删除 table2 中存在的所有条目?
【问题讨论】:
标签: kdb
select from table1 where not([]date;id)in table2
【讨论】:
/ 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
【讨论】: