Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
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
saran7de
Master
Master

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
saran7de
Master
Master

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

saran7de
Master
Master

Output:

commQV53.PNG

QFabian
Specialist II
Specialist II

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