我有两张这样的表:
Table1:
LOAD * INLINE [
OrderItem
OI1
OI2
OI3
OI4
OI6
];
Table2:
LOAD * INLINE [
OrderItem
OI2
OI3
OI4
OI5
OI6
];
现在我想要第三张表,告诉我仅 OI5不在“Table1”中! Listbox解决方案也可以。
我尝试了一些加入的东西,它没有用。我也读过this 但它只显示了列表框中两个表之间的区别。见下文:
Table1:
LOAD * INLINE [
OrderItem
OI1
OI2
OI3
OI4
OI6
];
Concatenate(Table1)
Table2:
LOAD * INLINE [
OrderItem
OI2
OI3
OI4
OI5
OI6
];
INNER JOIN (Table1)
LOAD *
WHERE "Only in One Table?"
;
// Here I want "OI5" as an output
Difference:
LOAD
OrderItem,
if(count(OrderItem)<2,-1) as "Only in One Table?"
RESIDENT Table1 GROUP BY OrderItem
;
结果:
谢谢!
答案 0 :(得分:3)
一种可能的解决方案:
Table1:
LOAD * INLINE [
OrderItem1
OI1
OI2
OI3
OI4
OI6
];
Table2:
LOAD * INLINE [
OrderItem2
OI2
OI3
OI4
OI5
OI6
];
Missings:
Load
OrderItem2 as MissingsOrderItem
Resident
Table2
Where
Not Exists(OrderItem1, OrderItem2)
;
重新加载后,结果将是:
答案 1 :(得分:-1)
从表2中选择LOAD *,其中LOAD不在(从表1中选择LOAD);