Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rafael5958
Creator
Creator

where exits between two tables

Hi, I have to compare two tables and set an column (yes/no) if the values are the same in a tirdh. Example:

table A:
x

table B:
a
s
d

table C:
a
s
d
status yes/no where a contains x

drop table b;

-------------------------------------------------

TABLE A
x
yy
gg
oo
çç
ee
ww
qq
zz
xx
cc
vv
bb

 

TABLE B  
asd
ffffff
gggggg
uuuuuu

 

TABLE C   
asdstatus
ffffffno
ggggggyes
uuuuuuno

 

drop table b;

Labels (1)
1 Solution

Accepted Solutions
Saravanan_Desingh

Try this,

TableA:
LOAD * INLINE [
    x
    yy
    gg
    oo
    çç
    ee
    ww
    qq
    zz
    xx
    cc
    vv
    bb
];

TableB:
LOAD *, If(Exists(x,a),'yes','no') As status;
LOAD * INLINE [
    a, s, d
    ff, ff, ff
    gg, gg, gg
    uu, uu, uu
];

Drop Field x;

View solution in original post

3 Replies
Saravanan_Desingh

Try this,

TableA:
LOAD * INLINE [
    x
    yy
    gg
    oo
    çç
    ee
    ww
    qq
    zz
    xx
    cc
    vv
    bb
];

TableB:
LOAD *, If(Exists(x,a),'yes','no') As status;
LOAD * INLINE [
    a, s, d
    ff, ff, ff
    gg, gg, gg
    uu, uu, uu
];

Drop Field x;
Saravanan_Desingh

Output:

commQV53.PNG

QFabian
Specialist III
Specialist III

Hi @rafael5958 , pease check if this works for you, the key here is the function EXISTS :

A:
Load
    x
FROM YOURSOURCE;

B:
Load
    a,
    s,
    d
    'Yes' as Status
FROM YOURSOURCE
where

    exists(x, a);

B:
Load
    a,
    s,
    d
    'No' as Status
FROM YOURSOURCE
where

     not exists(x, a);

 

QFabian