Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Where clause load comparing two tables field in Qlikview


Hi All,

How can we compare two same fields across table 1 and table 2 and load the same in Qlikview like below script?

EG.,

Table1:

LOAD *;
SELECT A, B;
FROM Table1
WHERE Table1.A = Table2. A;

Thanks,

Swathi

11 Replies
alexandros17
Partner - Champion III
Partner - Champion III

In a query like the one you have written, to access both tables you must at first join them:

SELECT A, B;
FROM Table1 join table2 on field1 = field2
WHERE Table1.A = Table2. A;


Hope it helps

jagan
Luminary Alumni
Luminary Alumni

Hi Swathi,

Try like this

Data:

SELECT

KeyField,

'

'

'

FROM Table1;

INNER JOIN (Data)

SELECT

KeyField,

'

'

'

FROM Table2;

OR simply

Table1:

LOAD *;
SELECT Table1. A, B
FROM Table1, Table2
WHERE Table1.A = Table2. A;


Regards,

jagan.

its_anandrjs

You can simply try with

Table1:

LOAD *;
SELECT A, B;
FROM Table1;

Inner Join(Table1)


Table2:

LOAD *;
SELECT A;
FROM Table2;



Not applicable
Author

Thanks All..

But requirement is instead of loading all the raw tables into a QVD then to join the tables on top of it.

Want to restrict the load in first level ie., i want to load the A field only for "WHERE Table1.A = Table2. A".

alexandros17
Partner - Champion III
Partner - Champion III

I understand but table2 is unknown until you load it ....

Not applicable
Author

try to:

1. load table2

2. load table 1 with "where exists (A)" clause;

3. drop table2



regards

Darek

Not applicable
Author

Yes Table2 is unknown till we load it.. So only way to do is

1.  load all the tables separately.

2. Do the Joins on top of it. ?

or any other options?

Not applicable
Author

try this script:

tab1:

LOAD * INLINE [

    A

    1

    2

    3

    5

];

NoConcatenate tab2:

load * Where Exists(A);

load * inline

[

    A

    4

    5

];

drop Table tab1;

alexandros17
Partner - Champion III
Partner - Champion III

If you have qvd then load them separately

Table1

noconcatenate

load * from qvd1;

join (or left join)

Table2

noconcatenate

load * from qvd2;

Hope it helps