Hi All,
I want to join the data from two tables called data9 and data11
Table Data_9
ID----plan_id------m_desc-------value9
9-- 501-R011-- 1/4/03-- 0000000000000114
9-- 501-R011-- 1/5/03-- 0000000000002394
9-- 501-R052-- 1/5/03-- 0000000000000258
9-- 502-R004-- 1/4/03-- 0000000000000010
9-- 502-R004-- 1/5/03-- 0000000000000006
9-- 502-R007-- 1/4/03-- 0000000000000012
9-- 502-R111-- 1/5/03-- 0000000000000019
9-- 515-P006-- 1/4/03-- 0000000000000500
9-- 515-R003-- 1/7/03-- 0000000000000033
9-- 515-R004-- 1/4/03-- 0000000000000046
9-- 515-R004-- 1/5/03-- 0000000000000020
Table Data 11
Id----plan_id-----m_desc-----value11
11-- 412-N005-- 1/5/03-- 0000000000000116
11-- 501-R011-- 1/5/03-- 0000000000002394
11-- 501-R052-- 1/5/03-- 0000000000000228
11-- 502-R004-- 1/5/03-- 0000000000000010
11-- 502-R007-- 1/5/03-- 0000000000000034
11-- 502-R111-- 1/5/03-- 0000000000000012
11-- 515-P006-- 1/4/03-- 0000000000000500
11-- 515-P006-- 1/5/03-- 0000000000000010
11-- 515-R003-- 1/4/03-- 0000000000000066
11-- 515-R004-- 1/5/03-- 0000000000000046
The Result that I am expecting is a table and a flat file
Plan_id------m_desc-------value9-------------value11
412-N005-- 1/5/03-- 0000000000000000-- 0000000000000116
501-R011-- 1/4/03-- 0000000000000114-- 0000000000000000
501-R011-- 1/5/03-- 0000000000002394-- 0000000000002394
501-R052-- 1/5/03-- 0000000000000258-- 0000000000000228
502-R004-- 1/4/03-- 0000000000000010-- 0000000000000000
502-R004-- 1/5/03-- 0000000000000006-- 0000000000000010
502-R007-- 1/4/03-- 0000000000000012-- 0000000000000000
502-R007-- 1/5/03-- 0000000000000000-- 0000000000000034
502-R111-- 1/5/03-- 0000000000000019-- 0000000000000012
515-P006-- 1/4/03-- 0000000000000500-- 0000000000000500
515-P006-- 1/5/03-- 0000000000000000-- 0000000000000010
515-R003-- 1/7/03-- 0000000000000033-- 0000000000000000
e.g.
if data9.plan_id” and “ data9.m_desc” = data11.plan_id” and “ data11.m_desc” for both the “id”( i.e. for 9 and 11)then it will show both the values ( value9 and value11) in one line ( as 3rd record in above table) if any one value is missing for any one id then it will get filled with “0” ( length = 16)e.g 1st record in above table
I also want output in a flat file , how can I do it with query ,or do I need to use pl/sql?
Pls help me
Mangesh
I want to join the data from two tables called data9 and data11
Table Data_9
ID----plan_id------m_desc-------value9
9-- 501-R011-- 1/4/03-- 0000000000000114
9-- 501-R011-- 1/5/03-- 0000000000002394
9-- 501-R052-- 1/5/03-- 0000000000000258
9-- 502-R004-- 1/4/03-- 0000000000000010
9-- 502-R004-- 1/5/03-- 0000000000000006
9-- 502-R007-- 1/4/03-- 0000000000000012
9-- 502-R111-- 1/5/03-- 0000000000000019
9-- 515-P006-- 1/4/03-- 0000000000000500
9-- 515-R003-- 1/7/03-- 0000000000000033
9-- 515-R004-- 1/4/03-- 0000000000000046
9-- 515-R004-- 1/5/03-- 0000000000000020
Table Data 11
Id----plan_id-----m_desc-----value11
11-- 412-N005-- 1/5/03-- 0000000000000116
11-- 501-R011-- 1/5/03-- 0000000000002394
11-- 501-R052-- 1/5/03-- 0000000000000228
11-- 502-R004-- 1/5/03-- 0000000000000010
11-- 502-R007-- 1/5/03-- 0000000000000034
11-- 502-R111-- 1/5/03-- 0000000000000012
11-- 515-P006-- 1/4/03-- 0000000000000500
11-- 515-P006-- 1/5/03-- 0000000000000010
11-- 515-R003-- 1/4/03-- 0000000000000066
11-- 515-R004-- 1/5/03-- 0000000000000046
The Result that I am expecting is a table and a flat file
Plan_id------m_desc-------value9-------------value11
412-N005-- 1/5/03-- 0000000000000000-- 0000000000000116
501-R011-- 1/4/03-- 0000000000000114-- 0000000000000000
501-R011-- 1/5/03-- 0000000000002394-- 0000000000002394
501-R052-- 1/5/03-- 0000000000000258-- 0000000000000228
502-R004-- 1/4/03-- 0000000000000010-- 0000000000000000
502-R004-- 1/5/03-- 0000000000000006-- 0000000000000010
502-R007-- 1/4/03-- 0000000000000012-- 0000000000000000
502-R007-- 1/5/03-- 0000000000000000-- 0000000000000034
502-R111-- 1/5/03-- 0000000000000019-- 0000000000000012
515-P006-- 1/4/03-- 0000000000000500-- 0000000000000500
515-P006-- 1/5/03-- 0000000000000000-- 0000000000000010
515-R003-- 1/7/03-- 0000000000000033-- 0000000000000000
e.g.
if data9.plan_id” and “ data9.m_desc” = data11.plan_id” and “ data11.m_desc” for both the “id”( i.e. for 9 and 11)then it will show both the values ( value9 and value11) in one line ( as 3rd record in above table) if any one value is missing for any one id then it will get filled with “0” ( length = 16)e.g 1st record in above table
I also want output in a flat file , how can I do it with query ,or do I need to use pl/sql?
Pls help me
Mangesh