Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Joining multiple SQL selects into one

Hello

I've got problem with SQL selects - I've got 4 selects, but Qlik loads only first one. I've tried putting joins between them, but none worked yet.

My code looks like this:

Data:

SQL SELECT * FROM QV_FAB_1(201501);

LEFT JOIN (Data)

SQL SELECT * FROM  QV_FAB_2(201501);

LEFT JOIN (Data)

SQL SELECT * FROM  QV_FAB_3(201501);

JOIN

SQL SELECT * FROM  QV_FAB_4;

I tried doing something like this:

Data:

SQL SELECT * FROM QV_FAB_1(201501);

Data2:

SQL SELECT * FROM  QV_FAB_2(201501);

And it wasn't working.

My final target is to get this SQL tables and write them into .qvd, it works but only for first select, columns from 2, 3, and 4 don't exist in Qlik.

1 Solution

Accepted Solutions
Not applicable
Author

I don't beleive you need the SQL bit in your script

ie the below should work.

Data:

SELECT * FROM QV_FAB_1(201501);

Data2:

SELECT * FROM  QV_FAB_2(201501);

View solution in original post

8 Replies
rajkumarb
Creator II
Creator II

HI

Check your Table Data

While you are doing a left Join you all four SQL tables Joined together into one single table

Not applicable
Author

I don't beleive you need the SQL bit in your script

ie the below should work.

Data:

SELECT * FROM QV_FAB_1(201501);

Data2:

SELECT * FROM  QV_FAB_2(201501);

Not applicable
Author

That is if you want seperate tables

Not applicable
Author

When i'm doing this:

Data:

SELECT * FROM QV_FAB_1(201501);

Data2:

SELECT * FROM  QV_FAB_2(201501);

fields from QV_FAB_1 are good and everything is OK, but from QV_FAB_2 there are only empty names of columns, without any data.

Not applicable
Author

This should work, is there definately data in the tables?

Or
MVP
MVP

Sounds like what you're looking for is

SELECT * FROM TABLE1;

CONCATENATE

SELECT * FROM TABLE1;

etc.

That said, you should avoid using select * when using JOIN or CONCATENATE - type out the columns to make sure at least one has the same name so QlikView knows what column(s) to merge on.

Not applicable
Author

OK, you're right. I messed up and procedure returned nothing, thank you for helping me.

Not applicable
Author

No problem.