Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
etrotter
Creator II
Creator II

Joining tables help

Hello, I'm having trouble joining three tables. I'd even settle for a keep, the top table has a limited data set while the other two tables have huge amounts of data that we do not need. The issue that I keep running into is that Shipments is a concatenated table with many years contained within it. Any ideas?

FOR i = 0 to 2

Data_T:

LOAD

Field1,

Field2,

Materials

FROM  Quotes_CFYM$(i).QVD  (qvd);

NEXT;


Materials:

LOAD

Materials,

MaterialID

From Materials.QVD;


Shipments:

LOAD

MaterialID,

FieldA,

FieldB

from ShipmentYear*.qvd

3 Replies
vishsaggi
Champion III
Champion III

IF you run this script as is, are you facing any errors? IF not did you check the data model how it looks like.

etrotter
Creator II
Creator II
Author

Above runs just fine, but I want the three table to be joined. If I try to join them with the below script, it only the first shipment year joins, and the rest load as nonconcatenated separate tables.



FOR i = 0 to 2

Data_T:

LOAD

Field1,

Field2,

Materials

FROM  Quotes_CFYM$(i).QVD  (qvd);

NEXT;

Left join (Data_T)

Materials:

LOAD

Materials,

MaterialID

From Materials.QVD;


Left join (Data_T)

Shipments:

LOAD

MaterialID,

FieldA,

FieldB

from ShipmentYear*.qvd

vishsaggi
Champion III
Champion III

May be try this in the below order?

ShipmentsConcat:

LOAD

MaterialID,

FieldA,

FieldB

from ShipmentYear*.qvd;

FOR i = 0 to 2

NoConcatenate

Data_T:

LOAD

Field1,

Field2,

Materials

FROM  Quotes_CFYM$(i).QVD  (qvd);

NEXT;

Left join (Data_T)

NoConcatenate

Materials:

LOAD

Materials,

MaterialID

From Materials.QVD;


Left join (Data_T)

NoConcatenate

Shipments:

LOAD *

From ShipmentsConcat;

Drop Table ShipmentsConcat;