Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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

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
Luminary Alumni
Luminary Alumni

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
MVP
MVP

This line seems to be odd:

LKEY,,


Also, a strange quoting here:


'1’ as Identifier

Astrato.io Head of R&D
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
MVP
MVP

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

LKEY,,

Astrato.io Head of R&D