1

我有两个这样的表:

Table1:
LOAD * INLINE [
OrderItem
OI1
OI2
OI3
OI4
OI6
];

Table2:
LOAD * INLINE [
OrderItem
OI2
OI3
OI4
OI5
OI6
];

现在我想要第三张表,它告诉我只有OI5 不在“Table1”中!列表框解决方案也可以。

我用连接位尝试了一些东西,但没有用。我也读过这个 ,但它只向我展示了列表框中两个表之间的区别。见下文:

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
;

结果:

在此处输入图像描述

谢谢!

4

2 回答 2

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)  
;   

重新加载后结果为:

在此处输入图像描述

于 2016-07-15T12:36:55.070 回答
-1

Select LOAD * from Table 2 where LOAD not in (Select LOAD from Table 1);

于 2016-07-15T11:16:23.473 回答