I have a product feed that lists clothing items multiple times, once each for every colour and size that the item is available in.
ProductID Product Name Colour Size Price
1 Men's Board Shorts Blue S 4.99
1 Men's Board Shorts Blue M 4.99
1 Men's Board Shorts Blue L 5.99
1 Men's Board Shorts Red S 4.99
1 Men's Board Shorts Red M 4.99
1 Men's Board Shorts Red L 5.99
I have two tables: One for the name & ID and another table for the id, colour, size and price for each product.
In the first table, I only want the name of the product to appear ONCE for each product, irrespective of the number of different sizes and colours. In the second table I want the product’s ID code, the size and price to appear for each of the different colours that are available.
So I would end up with the following data:
Product Table
1 Men's Board Shorts
Options Table
1 Blue S 4.99
1 Blue M 4.99
1 Blue L 5.99
1 Red S 4.99
1 Red M 4.99
1 Red M 5.99
The reason for separating the sizes into individual records instead of have size S,M,L in one field is that sometimes the price for the large item is different to the price for the small and medium sized items.
Any ideas to get me started/pointed in the right direction?
Thanks…
Creation of the 2 tables:
Fetching & inserting records in the tables: