Item Size In Stock ------------------------------------------ ItemA S 1 M 2 L 0 XL 0 ItemA S 0 M 0 L 5 XL 0just because it's a lot easier to generate a straight forward query, I'm going to simplify the query so it reflects the join to the sizes table only:
select items.PartNo,; items.Stock, ; sizes.Size ; from items ; inner join sizes on items.SizeID = sizes.SizeIDthis will work for any type of sizing.
select items.PartNo,; items.Stock, ; sizes.Size, ; sizes.SizeOrder ; from items ; inner join sizes on items.SizeID = sizes.nSizeIDIn my inventory report I would use the grouping footers for each Item to display the available stock, the expression for the field with the stock for each size would look something like this:
iif(SizeOrder = 1,Stock,0) && For the first size (small for example) iif(SizeOrder = 2,Stock,0) && For the the second size (medium) . .It's a little more complicated, but if you have very well defined sizing shemes it shouldn't be too difficult to implement.
>Item S M X XL XXL
>------------------------------------------
>ItemA 1 2 0 0 10
>ItemB 0 0 0 1 0
>