Ok, I have a problem that i've searched and searched for solutions to online and can't find any leads, here it is (oh, and i'm very new to this database stuff ;-)
Lets say I have thousands of retail stores and each one can carry 1 to 100 products, but there are 10,000 possible products available. I need each store owner to be able to see (and edit) the list of products in their store - this is straightforward and I can figure out the table structure for this - but what I also want to do is to be able to find the most common product combinations across stores, so for example I want to see something like:
120: pid34, pid234, pid876, pid120, pid100 118: pid45, pid54, pid657, pid763, pid237 115: pid23, pid546, pid657, pid543, pid23
Where the first number is the number of stores with those products (order of the products within the store doesn't matter), and the pid numbers are the product ids of the products (except remember there could be up to 100 products in each store).
So if I set up a table of:
ID, PID, Store ID 1, pid34, 10 2, pid234, 10 3, pid876, 10 4, pid120, 10 5, pid100, 10 6, pid45, 45 ... etc ...
I can keep track of my store inventories, but i've no idea how I can do my 'combinations' search, help!