I have two tables, let's call one Items and one Inventory.
The items table has a column for the item#, and then 3 columns for accessories, ACC1, ACC2 and ACC3. The inventory table has item# and quantity on hand.
I would like to be able to display this as:
item#A Acc1 qtyonhand
item#A Acc2 qtyonhand
item#A Acc3 qtyonhand
item#B Acc1 qtyonhand
So that each line would be the item and a unique accessory. If the Acc1,2,or 3 column is empty, the line should not be shown.
How would I write this in SQL? I've failed in every attempt I've made to get these exact results.
Thanks in advance!