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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
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

6 Replies
Not applicable
Author

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
Author

Hi ijprakash,

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

Thank you,

Przemek

martinpohl
Partner - Master
Partner - Master

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
Author

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

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
Author

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

Regards,

Przemek