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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

UNION ALL in SELECT Statement


Hi all,

Please advise on UNION All in Select query,How to use:

Select

Details1 as Details,

a,

b,

c

From A

UNION ALL

Select

Details2 as Details,

a,

b,

c

From B;

Above statement is not working in load script.

I want to extract data with a select statement

for performance tuning.

Thanks for help

Nitha

Labels (1)
33 Replies
rajeshvaswani77
Specialist III
Specialist III

Hi Nitha,

Your statement should be

tablename:

LOAD *;

SQL SELECT
  Details1 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '1’ as Identifier
  From RSID
UNION ALL
SELECT
  Details2 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '2' as Identifier 
FROM RSIF
UNION ALL
SELECT
  Details3 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '3' as Identifier
FROM RSIG
;

ashfaq_haseeb
Champion III
Champion III

Hi,

Try by adding schema name before table name.

Regards

ASHFAQ

jagan
Partner - Champion III
Partner - Champion III

Hi,

First load single table if it is loading single table, then include SQL keyword like below, hope this is the issue

Data:

SQL SELECT
  Details1 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '1’ as Identifier
  From RSID
UNION ALL
SELECT
  Details2 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '2' as Identifier 
FROM RSIF
UNION ALL
SELECT
  Details3 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,,
  '3' as Identifier
FROM RSIG;


Regards,

Jagan.

Anonymous
Not applicable
Author

Still it loads only first table and doesn't load rest of tables after UNION ALL

rbecher
Partner - Master III
Partner - Master III

This line seems to be odd:

LKEY,,


Also, a strange quoting here:


'1’ as Identifier

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
Anonymous
Not applicable
Author

Hi Ralf,

actual script its text not numbers.

ashfaq_haseeb
Champion III
Champion III

I would suggest you to run script by adding one table at a time first to make sure you get data then later use union.

Regards

ASHFAQ

Not applicable
Author

If its Query working on Oracle, Create a View with query and Call the query in Qlikview.

Not applicable
Author

Or use UNION function instead of UNION ALL

rbecher
Partner - Master III
Partner - Master III

What's about this wrong syntax (double comma):

LKEY,,

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine