combining two unrelated tables?

newmusicmark

New Member
Joined
Dec 16, 2002
Messages
7
Hi,
I have one table of stores. Store # is the primary key.

I have another table of product with a unique sku # for each product.

I need to make a new table that lists every product available for each store.

Example.
Store sku
1 1
1 2
1 3
2 1
2 2
2 3

Neither table has any common fields but the resultant table will.

Thanks,
Mark
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Will every product be available in every store? to get this just stick both tables in a query with out joining them.

HTh

Peter
 
Upvote 0
If you are trying to set up a many-to-many relationship (i.e. each store sells multiple products and each product can be sold by multiple stores) then you are going the right way about it.

The previous answer about setting up a query will show you the combinations based on the data entered into the two tables to date. If you are encountering "too complex" problems with subsequent queries or if you wish to set up all possible combinations (rather than rely on data entered to date) then you may consider storing the combinations in a new table with just the fields "store id" and "product id", setting up both fields as a joint primary key and then adding the table to your relationships.

If you link the stores table to the new table via "store id" as a one-to-many relationship and the products table to the new table via "product id", also as a one-to-many relationship, then you have got yourself a many-to-many relationship between the stores and products.

To populate this new table with all possible combinations, you will need a script or a macro with an append query to add every product for every store (you may be able to work that out yourself, if not let us know). You might also consider using the same sort of script / macro / append query every time you add either a new store or a new product. If you don't do this then this new table will be stuck in a time warp with your original data. As the number of stores and products increase you are going to want this task automated.

Hope this helps, Andrew :biggrin:
 
Upvote 0

Forum statistics

Threads
1,221,813
Messages
6,162,117
Members
451,743
Latest member
matt3388

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top