Stored Procedure to return related products
Posted on 2009-05-19
I have a table that holds products and has a primary key field called ID. I have a second table called tblRelatedProducts which looks as below
ID ItemID RelatedProductID
1 3 10
2 3 11
3 3 12
I need to be able to write a stored procedure that I can pass ItemId = 3 and returns all the product informaiton about products 10, 11, 12 as these are realted to Item 3.
Please can you point me in the right direction on how I can achieve this in a stored procedure?
Thanks in advance.