Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
GS1
Starting Member
27 Posts |
Posted - 2003-12-02 : 09:29:46
|
| HiI need to set up a table (Products) where each product may have an equivalent (similar product).How should I set the table up, so that a query can be run on a given product to return all (if any) related products to it?I think that this is a case for self joins, but i'm not sure...Thanks |
|
|
VyasKN
SQL Server MVP & SQLTeam MVY
313 Posts |
Posted - 2003-12-02 : 10:42:05
|
| How about maintaining a separate table, that lists the related products for all products? In this case, to list related products for product 'x', you will have to query this table for product 'x' and you get a list of related products back.--HTH,Vyashttp://vyaskn.tripod.com |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-12-02 : 13:42:21
|
| CREATE TABLE ProductRelationships(ProductName varhcar(25),RelatedProduct varchar(25))Brett8-) |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-12-02 : 19:08:04
|
| I would assume all related products would have some common attribute that would be the basis of the grouping and selecting. i.e., a common "ProductLine" column or something of that nature.- Jeff |
 |
|
|
|
|
|