Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to get many tables from one select?

Hi All,

how could I change the below example into one SELECT to get three tables?

Department_1:

SELECT Name, Department FROM Employees WHERE Department = 1;

Department_2:

SELECT Name, Department FROM Employees WHERE Department = 2;

Department_3:

SELECT Name, Department FROM Employees WHERE Department = 3;

Thank you,

Przemek

Tags (1)
6 Replies
Not applicable

How to get many tables from one select?

Hi,

if your qlikview application directly connected with db you can use following SQL statements

SQL Select * from Employees where Department <=3

or

Load * From Emplyees where Department <=3;

Not applicable

How to get many tables from one select?

Hi ijprakash,

what I mean is to get 3 seperate tables: Department_1, Department_2 and Department_3.

Thank you,

Przemek

martinpohl
Valued Contributor II

How to get many tables from one select?

Hello Przemek,

in your select order QlikView will generate ONE table with all fields automatically because the table strustures are the same.

To generate three table you need a

noconcatenate load ....

Regards

Not applicable

How to get many tables from one select?

Hi Martin, good point. I've changed the code and coming back to my question - how to change it into one SELECT and get three tables.

NoConcatenate LOAD Name, Department;

Department_1:
SELECT Name, Department FROM Employees WHERE Department = 1;

NoConcatenate LOAD Name, Department;

Department_2:
SELECT Name, Department FROM Employees WHERE Department = 2;

NoConcatenate LOAD Name, Department;

Department_3:
SELECT Name, Department FROM Employees WHERE Department = 3;

martinpohl
Valued Contributor II

How to get many tables from one select?

for i = 1 to 3

Department_$(i):

noconcatenate select Name, Department from Emplyees where Department = $(i);

next;

But you will get three identical tables (from the structure)

Regards

Not applicable

How to get many tables from one select?

Thank you, Martin. I meant sth a bit different but you answer led me to the point.

Regards,

Przemek

Community Browser