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

Try putting the query in brackets (sql query)

christian77
Partner - Specialist
Partner - Specialist

Hi.

Do you have access to the database?

Try to run the statement in the SQL engine.

Remember that UNION will work if they are exactly the same fields in the same order.

Why don't you concat in Qlik as they advise you in the 1st comment? The result should be the same.

Can you try a loop?

Chris.


PrashantSangle

Hi,

try like with where clause

like this

Test:

SQL SELECT
  Details1 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '1’ as Identifier
  From RSID

Where 1=1
UNION ALL
SELECT
  Details2 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '2' as Identifier 
FROM RSIF

Where 1=1
UNION ALL
SELECT
  Details3 as Details,
  CONTROL_KEY ,
  PKEY,
  LKEY,
  '3' as Identifier
FROM RSIG

Where 1=1;

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 🙂
Anonymous
Not applicable
Author

Hi all,

Below script is working now

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

thanks for all help