Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
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
MVP
MVP

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

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.