Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have tableA which is:
numberA
1
2
3
4
5
i have another tableB which is:
numberB
2
4
5
how can i add a column in tableA if the value in tableB then i add yes, if not, add no. which is:
numberA check
1 no
2 yes
3 no
4 yes
5 yes
shall i use if(numberA resident numberB, yes, no) ? thanks a lot
May be like this:
MappingTable:
Mapping
LOAD numberB,
'Yes' as Flag
LOAD * INLINE [
numberB
2
4
5
];
TableA:
LOAD *,
ApplyMap('MappingTable', numberA, 'No') as check
INLINE [
numberA
1
2
3
4
5
];
Try This
numberB:
LOAD * INLINE [
numberB
2
4
5
];
numberA:
LOAD * INLINE [
numberA
1
2
3
4
5
];
Left Join
test:
Load
numberA,
'Yes' as Check
Resident numberA where Exists(numberB,numberA);
Final:
Load
numberA,
If (Len(Check)>0,'Yes' ,'No') as Check1
Resident numberA;
Drop table numberA;
another option could be
TableB:
load * inline [
numberB
2
4
5
];
TableA:
load
*,
if(Exists(numberB, numberA), 'yes', 'no') as FlagExists
inline [
numberA
1
2
3
4
5
];