steps to achieve that
1- get related parts to part exist on temp table #temp that have same masked id from temp table #parts
in this case result will be
- PartId MaskId ChemicalId
- 200 1000 901
- 500 1700 909
- 600 1700 909
2- check on temp table #chemical for partid or related part id for same maskId
if chemicalid on step 1 different to chemicalid on temp table chemical
then nothing happen on status .
if checmicalid on step 1 same chemicalid on temp table chemical
then status will updated to conflict based on part id .
Here 200 have 901 chemical id on temp table #temp and on chemical temp table have 901 for 100
then status will be conflict because it related to same mask id and have same chemical id 901 .
Here 700 have 909 chemical id on temp table #temp and on chemical temp table have 909 for 500 and 600
then status will be nothing changed because it related to same mask id and have different chemical id 920.