Bonjour,
J'ai une table BomRange qui contient les champs suivants:
FinishedItemCode
FinishedAdditionalItemCode
ComponentCode
AdditionalComponentCode
Pour un même produit fini je peux avoir plusieurs lignes du style:
FinishedItemCode FinishedAdditionalItemCode ComponentCode AdditionalComponentCode ARTICLE1 BLANC PROFIL1 BLANC ARTICLE1 BLANC COMPO1 BLANC ARTICLE1 BLANC COMPO2 BLANC ARTICLE2 BLANC PROFIL2 BLANC ARTICLE2 BLANC COMPO1 BLANC ARTICLE2 BLANC COMPO3 BLANC ARTICLE3 BLANC PROFIL2 BLANC ARTICLE3 BLANC COMPO3 BLANC ARTICLE3 BLANC COMPO1 BLANC ARTICLE4 BLANC PROFIL1 BLANC ARTICLE4 BLANC COMPO1 BLANC ARTICLE4 BLANC COMPO3 BLANC
Je cherche donc tous les articles qui contiennent des composants identiques: exemple PROFIL1 et COMPO1 me retournera ARTICLE1 et ARTICLE4.
J'ai testé une requête de style :
mais cette requête n'est pas bonne.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 SELECT DISTINCT FinishedItemCode, FinishedAdditionalItemCode FROM Production.BomRange WHERE ((ComponentCode='xxx' and AdditionalComponentCode='xxx') or (ComponentCode='yyy' and AdditionalComponentCode='yyy') or (ComponentCode='zzz' and AdditionalComponentCode='zzz') )
Une suggestion pour me diriger vers la bonne solution?.
Partager