ali0baba a écrit :
il suffit juste de regarder si le produit a ete commander par 2 client differents
un truc de ce genre devrait fonctionner (meme si ya plus simple ...) :
select distinct ar.NoArt , ar.désignation
from client c1,
client c2,
article ar
where ar.NoArt in (
SELECT DISTINCT De.NoArt
FROM détailCmde AS De,
commande AS Co,
client AS Cl ,
article AS AR WHERE De.NoCmde=Co.NoCmde AND Cl.NoClient=Co.NoClient
AND Ar.NoArt=De.NoArt AND c1.NoClient = Cl.NoClient
GROUP BY NoArt HAVING COUNT(De.NoArt)>1 )
and ar.NoArt in (
SELECT DISTINCT De.NoArt
FROM détailCmde AS De,
commande AS Co,
client AS Cl ,
article AS AR WHERE De.NoCmde=Co.NoCmde AND Cl.NoClient=Co.NoClient
AND Ar.NoArt=De.NoArt AND c2.NoClient = Cl.NoClient
GROUP BY NoArt HAVING COUNT(De.NoArt)>1 )
and c1.NoClient != c2.NoClient
GROUP BY ar.NoArt LIMIT 0, 30;
|