Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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/?
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);
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);
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);
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
thanks anand....can u explain how it wil works?
Hi Suresh,
You need to use concatenate statement. Something like below
Tab1:
Load *
From
Data1;
Concatenate(Tab1)
Tab2:
Load *
From
Data2;
Check the below link,
is there any way to merge the tables using two fields in a table?
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.
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