What's happening here is these are the parts(SKU) customers order, I take these parts and choose the vendor(VendrItem)that sell that part the cheapest(EachCost).
I already have the cheapest vendor in there as well as the cheapest part, I need to combine the SKUs.
The reason the SKUs are seperated in the first place is because different customers ordered them, but they're still the same parts.
I chose the cheapest vendors that will sell me those parts and now I need to combine the rows so I can tell the vendor how much of each SKU I need.
In other words, let's say I have 3 customers: A, B and C. Customer A orders 60 parts (SKU # is 123), Customer B orders 10 parts(SKU # is 445) and Customer C orders 15 parts (SKU # is 123).
There are two vendors: NIU and RWE
NIU sells the SKU # 123 parts for $1 each and sells the SKU # 445 $5 each
The vendor RWE sells the SKU # 123 parts for $2 each and sells the SKU # 445 $4 each
I choose Vendor NIU for the SKU # 123 parts because they sell them cheaper and I choose vendor RWE for SKU # 445 because they're cheaper.
Vendors have different names for their items so for SKU # 123, the vendor NIU calls it 45-NY and for vendor RWE, SKU #445 is 432
So I make a query using the info above to spit out this table:
-
SKU VendrItem Qty EachCost
-
123 45-NY 60 $1
-
123 45-NY 15 $1
-
445 432 10 $4
-
I want to give my order to the vendor, so Instead of showing them two different orders for a single part #, I want to combine them so I only give them one order instead of two.
-
SKU VendrItem Qty EachCost
-
123 45-NY 75 $1
-
445 432 10 $4
-
Can you give me a link on where I can learn aggregate queries?
Is there another way I should do this?