Code : Tout sélectionner
SELECT produit
FROM table table_u1
JOIN table table_u2 ON table_u1.produit = table_u2.produit
WHERE table_u1.client='machin' AND table_u2.client='truc'Code : Tout sélectionner
SELECT produit
FROM table
WHERE client='machin' AND produit IN( SELECT produit FROM table WHERE client='truc')
Code : Tout sélectionner
SELECT produit, COUNT(produit), GROUP_CONCAT(client)
FROM table
GROUP BY produit
ORDER BY COUNT(produit) DESCCode : Tout sélectionner
CREATE TEMPORARY TABLE temp SELECT DISTINCT client,produit
FROM `vente`
WHERE client >1;
SELECT produit, count(produit ),GROUP_CONCAT(client)
FROM temp
GROUP BY produit
HAVING count( produit ) >1
ORDER BY produit DESC
Code : Tout sélectionner
WHERE client IS NOT NULL