Salut,
J'ai fini par ecrire une requete qui me rend exactement le bon resultat mais ... elle est un peu crad je trouve.
Donc si qq1 a une solution pour optimiser son ecriture j'en serais ravi :-)
J'ai bien cherché en retirant les UNION et en mettant plusieurs close WHERE mais ca marche jamais.

D'avance merci

Ce qui m'embete c'est que toutes mes classes s1SkBlAg,s1Slim,s1HemIC,s1AmAcBP sont définies de la même maniere et les requetes ont tts la même structure. Je suis sur qu'il y a moyen d'optimiser avec un truc du genre :


View NON OK :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
create view s1FamDbv as select 
LeafFam.s1FamilyDescFR,
LeafFam.FamilyDesc,
LeafFam.FamilyName,
s1RawMat.PartNumber,
s1RawMat.SUPERSEDED,
s1RawMat.OBID
from LeafFam , s1RawMat, s1SkBlAg , s1Slim , s1AmAcBP, s1HemIC
where s1RawMat.ItemMstrOBID = s1SkBlAg.right AND LeafFam.OBID = s1SkBlAg.Left OR 
where s1RawMat.ItemMstrOBID = s1Slim.right AND LeafFam.OBID = s1Slim.Left OR 
where s1RawMat.ItemMstrOBID = s1HemIC.right AND LeafFam.OBID = s1HemIC.Left OR 
where s1RawMat.ItemMstrOBID = s1AmAcBP.right AND LeafFam.OBID = s1AmAcBP.Left;
commit;

View OK :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
create view s1FamDbv as select 
LeafFam.s1FamilyDescFR,
LeafFam.FamilyDesc,
LeafFam.FamilyName,
s1RawMat.PartNumber,
s1RawMat.SUPERSEDED,
s1RawMat.OBID
from LeafFam , s1RawMat, s1SkBlAg
where s1RawMat.ItemMstrOBID = s1SkBlAg.right AND LeafFam.OBID = s1SkBlAg.Left
UNION (
select 
LeafFam.s1FamilyDescFR,
LeafFam.FamilyDesc,
LeafFam.FamilyName,
s1RawMat.PartNumber,
s1RawMat.SUPERSEDED,
s1RawMat.OBID
from LeafFam , s1RawMat, s1Slim
where s1RawMat.ItemMstrOBID = s1Slim.right AND LeafFam.OBID = s1Slim.Left )
UNION (
select 
LeafFam.s1FamilyDescFR,
LeafFam.FamilyDesc,
LeafFam.FamilyName,
s1RawMat.PartNumber,
s1RawMat.SUPERSEDED,
s1RawMat.OBID
from LeafFam , s1RawMat, s1HemIC
where s1RawMat.ItemMstrOBID = s1HemIC.right AND LeafFam.OBID = s1HemIC.Left )
UNION (
select 
LeafFam.s1FamilyDescFR,
LeafFam.FamilyDesc,
LeafFam.FamilyName,
s1RawMat.PartNumber,
s1RawMat.SUPERSEDED,
s1RawMat.OBID
from LeafFam , s1RawMat, s1AmAcBP
where s1RawMat.ItemMstrOBID = s1AmAcBP.right AND LeafFam.OBID = s1AmAcBP.Left);
commit;