I have three tables:
Product with fields ProductID, ProductName (eg. 100, Shirt)
Option with fields ProductID, OptionID, OptionName (eg. 100, 200, Colour)
OptionValue with ProductID, OptionID, OptionValueID, ValueName (eg. 100, 200, 300, Blue)
They are related by same named ID fields (I realise that ProductID should be redundant in OptionValue but it is there if it helps).
Products can have any number of Options; Options can have any number of OptionValues.
I need a Query (or Procedure if no nested select is possible) to list every possible unique stock item.
Example:
Shirt, Large, Green, Short-Sleeved, with-Logo
Shirt, Large, Green, Short-Sleeved, no-Logo
Shirt, Large, Green, Long-Sleeved, with-Logo
Shirt, Large, Green, Long-Sleeved, no-Logo
Shirt, Large, Blue, Short-Sleeved, with-Logo
Shirt, Large, Blue, Short-Sleeved, no-Logo
Shirt, Large, Blue, Long-Sleeved, with-Logo
Shirt, Large, Blue, Long-Sleeved, no-Logo
etc., etc.
Please note, this is NOT:
SELECT Product.ProductName, Option.OptionName, OptionValue.ValueName
FROM product
INNER JOIN Option ON Option.ProductID = Product.ProductID
INNER JOIN OptionValue ON OptionValue.OptionID = Option.OptionID
Which would give, for Example:
Shirt, Colour, Green
Shirt, Colour, Blue
Shirt, Size, Large
Shirt, Size, Medium
Shirt, Size, Small
etc. etc.
This is driving me nuts!!!