I have two tables:
Part: id, partnumber Alternative: partid, alternativepartid
Let's say that Part contains the following records:
- 1 - part 1 2
- 2 - part 2
- 3 - part 3
- 4 - part 4
- 5 - part 5
And Alternative contains the following records:
- 1 - 2
- 1 - 3
- 2 - 4
- 3 - 5
I would like to create a query to get all parts that are related to a given id.
In my case that would mean that if I query for part 1 (id 1) I would like to find:
2 and 3 but also 4 and 5 as 4 is an alternative to 2 and 5 is an alternative to 3.
When I query for 3, I would like to find: 5, 1, 2, and 4
Does this make sense?
Would it be possible to retrieve the complete set of records in one query?
Thanks!