如何求存在于表A但不存在于表B的记录?

attachments-2022-08-1whYyPmX6308633f7b369.png

请先 登录 后评论

2 个回答

Bob

即left inner join,可以用如下SQL:

T1 = table(1 2 3 3 as id, 7.8 4.6 5.1 0.1 as value)
T2 = table(5 3 1 as id,  300 500 800 as qty)
select id, value, qty from lj(T1, T2, `id) where T2.id = NULL
请先 登录 后评论
Juntao Wang
t1 = table(2021.01.01..2021.01.30 as date, take(`A`B`C`D`F`G`F, 30) as code)
t2 = table(2021.01.15..2021.02.28 as date, take(`A`B`C`D`F`G`F, 45) as code)

// 方式一
timer select date, code from lj(t1, t2, `date`code) where isNull(t2.date) and isNull(t2.code)

// 方式二
t = select date,code from ej(t1,t2,`date`code)
myDict = dict(t.date, t.code)
select * from t1 where conditionalFilter(code, date, myDict) == true


请先 登录 后评论
  • 2 关注
  • 0 收藏,897 浏览
  • Johhny 提出于 2022-08-26 14:08

相似问题