Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

manojkumargowda
New Contributor III

Union query in Qliksense script

Hello,

I need to write below union query in load script. But it is throwing error. Can you pls let me know what causing this issue?

LOAD Id,

     a,

     b;

SQL SELECT Id,

     a,

     b

FROM "TableA"

Union all

SQL SELECT id,

     a,

     b

FROM "TableB";

5 Replies
ChennaiahNallani
Contributor III

Re: Union query in Qliksense script

In qllik sense or qlik view if two table have the same structure. It automatically concatenated(Union All) into one table.

Re: Union query in Qliksense script

Qlik Sense script doesn't know a UNION operator. You can use CONCATENATE instead:

MyUnionTable:

SQL SELECT Id,

     a,

     b

FROM "TableA"

CONCATENATE (MyUnionTable)

SQL SELECT id,

     a,

     b

FROM "TableB";


talk is cheap, supply exceeds demand
quddus_mohiuddi
New Contributor III

Re: Union query in Qliksense script

Hi Manoj,

Union All is an old method in Qlik scripting so you can use CONCATENATE keyword instead of that.

SQL unions require that the same fields, with the same data types exist in each SELECT in the same order.

QV concatenates do not require any of these, but 'missing' fields will get null values.

Regards,

Quddus Mohiuddin

manojkumargowda
New Contributor III

Re: Union query in Qliksense script

Hi Gysbert,

But SQL query with union works in Qlikview. It takes it as entire query. So this doesn't work only in Qliksense?

balabhaskarqlik
Honored Contributor

Re: Union query in Qliksense script

Every platform will have independent functionality, A concatenation is in principle the same as the SQL UNION statement.

Refer this:

https://help.qlik.com/en-US/sense/June2018/Subsystems/Hub/Content/Scripting/ScriptPrefixes/concatena...

Community Browser