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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
SMiller_FL
Contributor III
Contributor III

Like a Union Query

I have 4 tables that are joined to the same variable (Medid) in each table. I do not want to input this data when I initially load it into the same table because they different  file layouts. But I want to show a Table that has all the 'medid' appended together in one column. I'm used to Access and I could create a union query for this but I'm not able to figure this out. Thanks. 

Labels (1)
1 Solution

Accepted Solutions
rubenmarin1

Hi, this is in the script, in eacmple to concatenate the "Medid" field of all tables it could be:

DataTable:
LOAD Medid;
SELECT Medid FROM Managed;

Concatenate (DataTable)
LOAD Medid;
SELECT Medid FROM Output;

Concatenate (DataTable)
LOAD Medid;
SELECT Medid FROM UTR;

Concatenate (DataTable)
LOAD Medid;
SELECT Medid FROM NEwEnrlee;

In example if each table has only one row whit the same Medid value, you wll end with a 4 rows table, all ofur with the same Medid value (if Medid values are differnt the values will be different.

Join is a different thing, if you change 'Concatenate' by 'Outer Join' it will try to merge data from all tables where has the same Medid value. In this case the previous example will end with a one row table.

View solution in original post

3 Replies
rubenmarin1

Hi, check out for "Concatenate" it does the union of different tables: https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPref...

SMiller_FL
Contributor III
Contributor III
Author

I get this in theory but I am not yet understanding the language of Qlik so that I can write this. I have an App called "CM" so I guess that is the file name. I have the following table names which each have a 'Medid' field that I want to join:

- Managed

- Optout

- UTR

- NewEnrlee

If someone could help translate the syntax it would be much appreciated!!

 

 

rubenmarin1

Hi, this is in the script, in eacmple to concatenate the "Medid" field of all tables it could be:

DataTable:
LOAD Medid;
SELECT Medid FROM Managed;

Concatenate (DataTable)
LOAD Medid;
SELECT Medid FROM Output;

Concatenate (DataTable)
LOAD Medid;
SELECT Medid FROM UTR;

Concatenate (DataTable)
LOAD Medid;
SELECT Medid FROM NEwEnrlee;

In example if each table has only one row whit the same Medid value, you wll end with a 4 rows table, all ofur with the same Medid value (if Medid values are differnt the values will be different.

Join is a different thing, if you change 'Concatenate' by 'Outer Join' it will try to merge data from all tables where has the same Medid value. In this case the previous example will end with a one row table.