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

How can we do union in qlikview.

SELECT DISTINCT v_t3k_acct.acct_nbr,

       v_t3k_acct.inv_ofcr_cd,

       v_t3k_acct.inv_ofcr_nm,

       'inv_ofcr' AS Officer_Type

  FROM wonderbase.dbo.v_t3k_acct v_t3k_acct

  UNION

  SELECT DISTINCT v_t3k_acct.acct_nbr,

       v_t3k_acct.inv_portfolio_mgr_cd,

       v_t3k_acct.inv_portfolio_mgr_desc,

        'inv_portfolio_mgr' AS Officer_Type

  FROM wonderbase.dbo.v_t3k_acct v_t3k_acct

  UNION

  SELECT v_t3k_acct.acct_nbr,

         v_t3k_acct.inv_portfolio_spcl_cd,

       v_t3k_acct.inv_portfolio_spcl_desc,

       'inv_portfolio_spcl' AS Officer_Type

  FROM wonderbase.dbo.v_t3k_acct v_t3k_acct

Thank you.

1 Solution

Accepted Solutions
Not applicable
Author

Keep the both the tables filed name as same. automatically it will do union. You don't need to mention a function.in qlikview CONCATENATE is Union.

Regards,

Santhosh G

View solution in original post

16 Replies
tresesco
MVP
MVP

In qv, if you load multiple tables with all fields same names, they get concatenated (equivalent to UNION). Therefore, here you to do nothing but remove the UNION keyword and it will work.

Edit: If you need the result in distinctive way like in UNION, you might want to use DISTINCT with LOAD.

siva0606
Contributor III
Contributor III

Replace Concatenate instead of Union. It will work..

Regards,

Sivasu

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use concatenate AND alias the names in the second and third load to the same name:

SELECT DISTINCT v_t3k_acct.acct_nbr,

       v_t3k_acct.inv_ofcr_cd,

       v_t3k_acct.inv_ofcr_nm,

       'inv_ofcr' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct

Concatenate

SELECT DISTINCT v_t3k_acct.acct_nbr,

       v_t3k_acct.inv_portfolio_mgr_cd As inv_ofcr_cd,

       v_t3k_acct.inv_portfolio_mgr_desc As inv_ofcr_nm,

      'inv_portfolio_mgr' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct

Concatenate

SELECT v_t3k_acct.acct_nbr,

       v_t3k_acct.inv_portfolio_spcl_cd As inv_ofcr_cd,

       v_t3k_acct.inv_portfolio_spcl_desc As inv_ofcr_nm,

       'inv_portfolio_spcl' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi,

You can go to Script page and paste your Query and replace Union with Concatenate and mentioned " SQL " befour writting each of the sql Query.

 

 

SQL SELECT DISTINCT v_t3k_acct.acct_nbr,

v_t3k_acct.inv_ofcr_cd,

v_t3k_acct.inv_ofcr_nm,

'inv_ofcr' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct;


Concatenate



SQL

SELECT DISTINCT v_t3k_acct.acct_nbr,

v_t3k_acct.inv_portfolio_mgr_cd As inv_ofcr_cd,

v_t3k_acct.inv_portfolio_mgr_desc As inv_ofcr_nm,

'inv_portfolio_mgr' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct;


Concatenate



SQL

SELECT v_t3k_acct.acct_nbr,

v_t3k_acct.inv_portfolio_spcl_cd As inv_ofcr_cd,

v_t3k_acct.inv_portfolio_spcl_desc As inv_ofcr_nm,

'inv_portfolio_spcl' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct;

Thanks,

Shiven..

Anonymous
Not applicable
Author

Comparison of  Oracle and Qlikview Joins.................

1). "UNION"  is resembled by "OUTER JOIN"

2). "UNION ALL" is resembled by "CONCATENATE"

3). Condition >

     where T1.field1=T2.field2

                                          is "INNER JOIN" in Qlikview

4). Condition >

     where T1.field1=T2.field2(+)

                                          is "LEFT JOIN" in Qlikview

5). Condition >

     where T1.field1(+)=T2.field2

                                          is "RIGHTJOIN" in Qlikview

Regards

Nitin

sanketkhunte
Creator II
Creator II

Perfect Solution.

Not applicable
Author

Keep the both the tables filed name as same. automatically it will do union. You don't need to mention a function.in qlikview CONCATENATE is Union.

Regards,

Santhosh G

Not applicable
Author

Hi,

Thanks Nitin for the info , then as per the above query then we need to do this in script page:-

 

SQL SELECT DISTINCT v_t3k_acct.acct_nbr,

v_t3k_acct.inv_ofcr_cd,

v_t3k_acct.inv_ofcr_nm,

'inv_ofcr' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct;


outer join



SQL SELECT DISTINCT v_t3k_acct.acct_nbr,

v_t3k_acct.inv_portfolio_mgr_cd As inv_ofcr_cd,

v_t3k_acct.inv_portfolio_mgr_desc As inv_ofcr_nm,

'inv_portfolio_mgr' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct;


outer join



SQL

SELECT v_t3k_acct.acct_nbr,

v_t3k_acct.inv_portfolio_spcl_cd As inv_ofcr_cd,

v_t3k_acct.inv_portfolio_spcl_desc As inv_ofcr_nm,

'inv_portfolio_spcl' AS Officer_Type

FROM wonderbase.dbo.v_t3k_acct v_t3k_acct;

Thanks

Shiven..

Not applicable
Author

Hi

There is one more funtion " NOCONCATENATE" , then what is the diffrence between both ?

Thanks,

Shiven..