Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Combine two tables

Dear Gurus

I have following data

[Visit]:

LOAD * INLINE [

    RepCode, VisitDate, PlanDate, CombDate

    0928, 01.03.2018, , 01.03.2018

    0928, , 02.03.2018, 02.03.2018

    0928, 03.01.2018, 03.03.2018, 03.03.2018

    0428, 01.03.2018, , 01.03.2018

    0428, , 02.03.2018, 02.03.2018

    0428, 03.01.2018, 03.03.2018, 03.03.2018

    0933, 01.03.2018, , 01.03.2018

    0933, , 02.03.2018, 02.03.2018

    0933, 03.01.2018, 03.03.2018, 03.03.2018

];

[Calendar]:

LOAD * INLINE [

    CalDate

    01.03.2018

    02.03.2018

    03.03.2018

    04.03.2018

];

and with this data i want  a new table with records like followings

[Main]:

LOAD * INLINE [

    RepCode, VisitDate1, PlanDate1, CombDate1

    0428, 01.03.2018, , 01.03.2018

    0428, , 02.03.2018, 02.03.2018

    0428, 03.01.2018, 03.03.2018, 03.03.2018

    0428, , , 04.03.2018

    0933, 01.03.2018, , 01.03.2018

    0933, , 02.03.2018, 02.03.2018

    0933, 03.01.2018, 03.03.2018, 03.03.2018

    0933, , , 04.03.2018

    0928, 01.03.2018, , 01.03.2018

    0928, , 02.03.2018, 02.03.2018

    0928, 03.01.2018, 03.03.2018, 03.03.2018

    0928, , , 04.03.2018

];

How to make a product of above two tables

6 Replies
ychaitanya
Creator III
Creator III

[Visit]:

LOAD * INLINE [

    RepCode, VisitDate, PlanDate, CombDate

    0928, 01.03.2018, , 01.03.2018

    0928, , 02.03.2018, 02.03.2018

    0928, 03.01.2018, 03.03.2018, 03.03.2018

    0428, 01.03.2018, , 01.03.2018

    0428, , 02.03.2018, 02.03.2018

    0428, 03.01.2018, 03.03.2018, 03.03.2018

    0933, 01.03.2018, , 01.03.2018

    0933, , 02.03.2018, 02.03.2018

    0933, 03.01.2018, 03.03.2018, 03.03.2018

];

Join(Visit)

[Calendar]:

LOAD * INLINE [

    CombDate

    01.03.2018

    02.03.2018

    03.03.2018

    04.03.2018

];

Anonymous
Not applicable
Author

Thanks for the reply,

i got the following result by joining the

    

CombDatePlanDateRepCodeVisitDate
01.03.2018 042801.03.2018
01.03.2018 092801.03.2018
01.03.2018 093301.03.2018
02.03.201802.03.20180428
02.03.201802.03.20180928
02.03.201802.03.20180933
03.03.201803.03.2018042803.01.2018
03.03.201803.03.2018092803.01.2018
03.03.201803.03.2018093303.01.2018
04.03.2018

but how to get 04.03.2018 with all repcodes with plandate and visitdate blank

ie

    

CombDatePlanDateRepCodeVisitDate
01.03.2018 042801.03.2018
01.03.2018 092801.03.2018
01.03.2018 092801.03.2018
02.03.201802.03.20180428
02.03.201802.03.20180928
02.03.201802.03.20180933
03.03.201803.03.2018042803.01.2018
03.03.201803.03.2018092803.01.2018
03.03.201803.03.2018093303.01.2018
04.03.2018 0428
04.03.2018 0928
04.03.2018 0933

Thanks

shiveshsingh
Master
Master

Which field is common in both the tables?

Do you want cartesian join?

Anonymous
Not applicable
Author

yes a cartesian join. for every RepCode vs CombDate

ychaitanya
Creator III
Creator III

i see CombDate is common between them

shiveshsingh
Master
Master

Then he can probably outer join the tables