Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

RE:Merge

hi all,

how to merge two tables into one table?

IN BOTH TABLE LVL_ID IS COMMON..

Note:  Without using joins

suppose i hve fields lik

Tab1:

lOAD lvl_id,

    req_id,

     req_name,

     req_desc,

     req_priority,

     create_date,

     req_moddate,

     create_by,

     mod_by,

     reqlast_action,

     req_status

FROM

[$(vSourceData)\newtable5.qvd]

(qvd);

Table2:

LOAD

lvl_id,

test_id,

     test_createon,

     test_desc,

     test_estmdevtime,

     test_lastaction,

     test_moddate,

     test_name,

     test_owner,

     test_type,

    

     tc_modifycount,

     test_delflag

FROM

[$(vSourceData)\newtable6.qvd]

(qvd);

how can i achive dis/?

1 Solution

Accepted Solutions
its_anandrjs

Simple use concatenate key word also add table flag

Tab1:

lOAD lvl_id,

    req_id,

     req_name,

     req_desc,

     req_priority,

     create_date,

     req_moddate,

     create_by,

     mod_by,

     reqlast_action,

     req_status ,

     'Table1' as TabFlag

FROM

[$(vSourceData)\newtable5.qvd]

(qvd);

Concatenate(Tab1)

LOAD

lvl_id,

test_id,

     test_createon,

     test_desc,

     test_estmdevtime,

     test_lastaction,

     test_moddate,

     test_name,

     test_owner,

     test_type,

    

     tc_modifycount,

     test_delflag,

    'Table1' as TabFlag

FROM

[$(vSourceData)\newtable6.qvd]

(qvd);

View solution in original post

16 Replies
Anonymous
Not applicable

simply try this:

Tab1:

lOAD lvl_id,

    req_id,

     req_name,

     req_desc,

     req_priority,

     create_date,

     req_moddate,

     create_by,

     mod_by,

     reqlast_action,

     req_status

FROM

[$(vSourceData)\newtable5.qvd]

(qvd);

inner/Left/Right  join(Tab1)    //Join based on your requirement, it may be left or right or inner

Table2:

LOAD

lvl_id,

test_id,

     test_createon,

     test_desc,

     test_estmdevtime,

     test_lastaction,

     test_moddate,

     test_name,

     test_owner,

     test_type,

   

     tc_modifycount,

     test_delflag

FROM

[$(vSourceData)\newtable6.qvd]

(qvd);

its_anandrjs

Simple use concatenate key word also add table flag

Tab1:

lOAD lvl_id,

    req_id,

     req_name,

     req_desc,

     req_priority,

     create_date,

     req_moddate,

     create_by,

     mod_by,

     reqlast_action,

     req_status ,

     'Table1' as TabFlag

FROM

[$(vSourceData)\newtable5.qvd]

(qvd);

Concatenate(Tab1)

LOAD

lvl_id,

test_id,

     test_createon,

     test_desc,

     test_estmdevtime,

     test_lastaction,

     test_moddate,

     test_name,

     test_owner,

     test_type,

    

     tc_modifycount,

     test_delflag,

    'Table1' as TabFlag

FROM

[$(vSourceData)\newtable6.qvd]

(qvd);

Chanty4u
MVP
MVP
Author

witout using joins...

i need to use two fileds lvl_id and req_id   using dis

and table2   use two fileds lvl_id and Test_Id

Chanty4u
MVP
MVP
Author

thanks anand....can u explain how it wil works?

tamilarasu
Champion
Champion

Hi Suresh,

You need to use concatenate statement. Something like below

Tab1:

Load *

From

Data1;

Concatenate(Tab1)

Tab2:

Load *

From

Data2;

tamilarasu
Champion
Champion

Chanty4u
MVP
MVP
Author

is there any way to merge the tables using two fields in a table?

jagan
Luminary Alumni
Luminary Alumni

Hi Suresh,

If only one field is common in both the tables then Concatenate is not the best choice, you can go for Joins(Left/Right/Inner) depends on your requirement.  Join to be done carefully, if there is many to many mapping then the records will be duplicated and numbers may be doubled/tripled.

The best suggestion is not to join, qlikview will join based on the common fields during runtime.

Hope this helps you.

Regards,

jagan.

its_anandrjs

When you use Concatenate between two tables then you get single table as result and if there is same fields like in your case lvl_id then when you use concatenate you get single field on resultant table. Also if you want to see the values of different table like Table1 >> lvl_id  or Table2 >> lvl_id then you can use the TableFlag to see the values.

If in one of the table there is master table or unique values then use JOINS (Inner / Left / Right)

Regards

Anand