Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Union Or Concatenate

Hello

I have a scenario

I would like to know if using Union would be good or Concatenate. If someone can show with an example it would be nice.

Table 1:

Load * from Tabl1.qvd(qvd);

Concatenate(Table1)

Table2:

Load

A as [Field1 from Table1],

B as [Field2 from Table1],

C as [Field3 from Table1]

from Table2.qvd(qvd);

Please Note: In Table 2 I am just pulling selective fields in Table 2 and renaming them as fields with the same name as in Table1 so that Concatenate takes care of the mapping.

Am I doing the concatenation correctly?

Or for the same scenario if I have to use a Union what would be the best way of using it.

Thx

6 Replies
sunny_talwar

‌i am not sure what you mean when you say union? I don't think you have that option in QlikView. What you do have is the ability to concatenate and the ability to join. You would use concatenate if you want to "append" data to your existing data and you would join if you have two tables which have common fields and you want to add a new column from one to the another. For example for concatenate

Table1

dim, value

A,20

B,30

Table2

dim, value

C,90

D,100

if i do something like this

Table1

LOAD * Inline

[dim, value

A,20

B, 30

];

concatenate (Table1)

LOAD * Inline

[dim, value

C,90

D,100

];

would result in a table like this

dim, value

A,20

B,30

C,90

D,100

example for join

Table1

dim,value

A,20

B,30

Table3

dim,price

A, 2

B, 5

you can join them the following way

Table1:

LOAD * Inline

[dim,value

A,20

B,30

];

Join (Table1)

LOAD * Inline

[dim, price

A,2

B,5

];

would result in

dim,value,price

A,20,2

B,30,5

I hope this helps...

Best,

Sunny

Not applicable
Author

Hello

Thx for the reply.

Can you please provide for my script example as I am trying load from qvds

and renaming my fields in table2 to make them identical as in table and

appending.

Thx

Riz

PrashantSangle

Hi,

In Qlikview UNION and Concatenate both are same thing.

When you write Sql select statement then you use UNION

and when you write LOAD statement i.e. QlikView Script then you use Concatenate.

both work Similar manner.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jaimeaguilar
Partner - Specialist II
Partner - Specialist II

Hi,

just to clarify: Concatenate is the QlikView equivalent to SQL Union,

regards

hariprasadqv
Creator III
Creator III

Hi,

Concatination and union are same in qlikview scripting.

petter
Partner - Champion III
Partner - Champion III

The AUTO CONCATENATION behaviour of QlikView load scripts when loading tables is similar to SQL UNION ALL as neither removes duplicates. Using CONCATENATE LOAD - which is what is called FORCED CONCATENATION - QlikView will make one table out of the two even if some or all of the fields are different - leaving fields that exist in one but not the other with null values. That can be done with SQL UNION too if you manually create the missing columns for each table in your SQL statement.

There is no mapping as such taking place - only the shared fields aligning into one field of course.