Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello everyone,
i have one simple question can u help me out.
suppose i have two table as shown in below:
tableA:
LOAD * INLINE [
name, value
a, 1
b, 2
c, 3
d, 4
e, 5
f, 6
];
tableB:
LOAD * INLINE [
name, value
c, 3
d, 4
e, 5
];
now i want to display only uncommon name and vale.
Expected output:
name value
a 1
b 2
f 6
thanks in advance.
do you want to do this at script or front end ? do you still want to keep both tables ?
here is a quick way of doing this, though will only keep table A with the non found values
mapping
tableB:
LOAD * INLINE [
name, value
c, 3
d, 4
e, 5
];
tableA:
Load
name,
value
where applymap('tableB', name,0) = 0
LOAD * INLINE [
name, value
a, 1
b, 2
c, 3
d, 4
e, 5
f, 6
];
do you want to do this at script or front end ? do you still want to keep both tables ?
here is a quick way of doing this, though will only keep table A with the non found values
mapping
tableB:
LOAD * INLINE [
name, value
c, 3
d, 4
e, 5
];
tableA:
Load
name,
value
where applymap('tableB', name,0) = 0
LOAD * INLINE [
name, value
a, 1
b, 2
c, 3
d, 4
e, 5
f, 6
];
here using the exists function, I change the name label on tableB
tableA:
LOAD * INLINE [
name, value
a, 1
b, 2
c, 3
d, 4
e, 5
f, 6];
tableB:
LOAD * INLINE [
name1, value
c, 3
d, 4
e, 5];
noconcatenate
tableC:
load
name,
value
resident tableA
where not exists (name1, name);
tableB:
LOAD * INLINE [
name1, value1
c, 3
d, 4
e, 5
];
tableA:
LOAD * INLINE [
name2, value2
a, 1
b, 2
c, 3
d, 4
e, 5
f, 6
]
WHERE Not Exists(name1, name2);
DROP Table tableB;
I added some records in tableB and checked on name and value
tableA:
LOAD *, 1 as fromA INLINE [
name, value
a, 1
b, 2
c, 3
d, 4
e, 5
f, 6
];
//tableB:
join (tableA)
LOAD *, 1 as fromB INLINE [
name, value
c, 3
d, 4
e, 5
x, 20
y, 21
z, 22
];
left join (tableA)
LOAD
name, value,
if(rangesum(fromA,fromB)=1, 1) as uncommon
Resident tableA;
thanks everyone its working fine...
thanks again