Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Merging to SQL Tables (union way, vertically)

Hi.

my script looks like this:

Table_A:

select ... from ... where ... ;

Table_B:

select ... from ... where ... ;

I want to merge these tables into Table_C?

Table_C:

[What's the script for it?]

Thank YOU.

5 Replies
Not applicable

Hi Gil

Qlikview is very different from SQL in that the script is more step-wise.

The cleanest way to achieve a merge of table A and B would be to load table A, then merge B into it as the next step using the "concatenate" statement. This would be the equivalent of a SQL select * from A union select * from B.

TableA: Load * from TableA;

concatenate(TableA) Load * from TableB;

Both tableA and table B are in table A.

Qlikview will automatically pick up fieldnames that are the same and put the values in the same column. Where column B has different filednames, then the rows in (original) table A will be null for these new fields.

Erica

MVP
MVP



Table_C:

//Table_A:

sql select ... from ... where ... ;

concatenate (Table_C)

//Table_B:

sql select ... from ... where ... ;

MVP & Luminary
MVP & Luminary

Hi,

Try like this

Table_C:

select ... from ... where ... ;

Concatenate(Table_C)

select ... from ... where ... ;

Regards,

Jagan.

Specialist
Specialist

Hi,

If the column names are identical in both the tables, you don't have to forcefully use "concatenate" to merge them together. QlikView will automatically merge them by writing below script and store them in table "Table_A"

Table_A:

select ... from ... where ... ;

Table_B:

select ... from ... where ... ;

If the names are not identical than using "concatenate" would be best option. See below,

Table_C:

select ... from ... where ... ;

Concatenate (Table_C)

select ... from ... where ... ;

Specialist III
Specialist III

Table_A:

Load ... from ... where ... ;

left join(Table_A)

//Table_B:

Load ... from ... where ... ;

Both table_A and table_B will be in to one single table based on the one field join.

If you want to merge these tables into Table_C?

Table_C:

Load *,

resident Table_A;

Drop table Table_A;

it will create one seperate table and will drop table_A and table_B