Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have 2 tables. The first has 3 fields:
Date, Supplier, Sales
the second has 3 fields
Date, Customer, Sales
Therefore I know the sales by customer by date and I know the sales by supplier by date and for any day the sum of sales are the same in both tables. I want to create a table that shows the sales by customer AND supplier. How can I do this?
Thanks
you an combine the two tables
Supplier:
noconcatenate load
Date,
Supplier,
Sales as Supplier.Sales
from ..
Customer:
noconcatenate load
Date,
Customer,
Sales as Customer.Sales
from ..
outer join(Supplier)
load *
resident Customer;
drop table Customer;
rename table Supplier to FactTable;
If I am thinking about this correctly, you might need another key field (May be OrderID) to order to know which supplier sold to which customer. Right now the way your two tables are structured seem to join the two tables on Date and Sales Amount. If for some reasons there are two Suppliers or Two Customers who did same amount of sales on the same day you will end up having a Cartesian product between the two tables. So I think having a OrderID will def. help here.
You can concatenate the two tables to create a single table with 4 columns: Date, Supplier, Customer, Sales
Sales:
load
Date,
Supplier,
Sales
from ..
concatenate(Sales)
load
Date,
Customer,
Sales
from ..