vanhuiszoo
New member
- Local time
- Yesterday, 19:17
- Joined
- Jul 27, 2017
- Messages
- 3
Hello,
I need to come up with a query to find our products with similar materials, and i'm hitting a wall. Here is an example what my initial table looks like:
What i need to find is how many parts are similar to each other. So i need to know that sku1 and sku4 both have the same materials, but also that sku1 and sku2 share 2 materials, etc. So my results should look something like:
What i can think of is that i need to loop over each sku and find all similar skus, but i can't think of how to do this in a query, but all of my data are in tables. so i'm stuck. Anyone have any ideas? Thank you!!
I need to come up with a query to find our products with similar materials, and i'm hitting a wall. Here is an example what my initial table looks like:
Code:
ID PartNo Material
1 sku1 A
2 sku1 B
3 sku1 C
4 sku2 A
5 sku2 C
6 sku3 B
7 sku3 C
8 sku4 A
9 sku4 B
10 sku4 C
What i need to find is how many parts are similar to each other. So i need to know that sku1 and sku4 both have the same materials, but also that sku1 and sku2 share 2 materials, etc. So my results should look something like:
Code:
PartNo SameAs CountOfMaterialsShared MaterialsShared
sku1 sku4 3 A,B,C
sku1 sku2 2 A,C
sku1 sku3 2 B,C
sku2 sku1 2 B,C
sku2 sku3 1 C
What i can think of is that i need to loop over each sku and find all similar skus, but i can't think of how to do this in a query, but all of my data are in tables. so i'm stuck. Anyone have any ideas? Thank you!!