Hi all, once again I am faced with a select statement that, although I could probably work it out myself, chances are that it will not be the most efficient way to do it..
Here is an example table to show what I am talking about:
ProductCode, ProductName, LinkProduct1, LinkProduct2
001, Bread, 002, 004
002, Butter, 003, NULL
003, Knife, NULL, NULL
004, Milk, NULL, NULL
If my user selected the ProductCode '001' the output datatable would look like this(Doesn't have to be in this order):
ProductCode, ProductName,
001, Bread
002, Butter
003, Knife
004, Milk
This is because they chose their main product (Bread) but whenever you buy bread the linked method dictates that you must also get Butter and Milk. Now because Butter was selected, it must also show Knife because that is Butters linked method.
My actual table has up to 6 possible linked Products.
I'm not lazy so I am not looking for the exact answer, I would just like pointing in the right direction please..
Thanks in advance for any replies.
John
.NET 2.0, Visual Studio 2005, SQL Server 2005 Express
Here is an example table to show what I am talking about:
ProductCode, ProductName, LinkProduct1, LinkProduct2
001, Bread, 002, 004
002, Butter, 003, NULL
003, Knife, NULL, NULL
004, Milk, NULL, NULL
If my user selected the ProductCode '001' the output datatable would look like this(Doesn't have to be in this order):
ProductCode, ProductName,
001, Bread
002, Butter
003, Knife
004, Milk
This is because they chose their main product (Bread) but whenever you buy bread the linked method dictates that you must also get Butter and Milk. Now because Butter was selected, it must also show Knife because that is Butters linked method.
My actual table has up to 6 possible linked Products.
I'm not lazy so I am not looking for the exact answer, I would just like pointing in the right direction please..
Thanks in advance for any replies.
John
.NET 2.0, Visual Studio 2005, SQL Server 2005 Express