I have a problem with my query: So, I have a table call supplier:
ref_article supplier_id
1903 10
I have another table call gift:
id_gift etat id_adresse ref_article
100455 3 1 1903
100456 3 2 1903
100457 3 3 1903
And I have the table gift_adresse:
id name surname
1 jkkjl hkj
2 hjhjk jklj
3 kjkj hjjkhk
My query is like this:
SELECT
supp.ref_article,
COUNT(g.id_instant_gagnant) AS gifts_number
FROM supplier supp
LEFT JOIN gift g ON supp.ref_article = g.ref_article
INNER JOIN gift_adresse g_adr ON g.id_adresse = g_adr.id_adresse
WHERE supp.supplier_id = 10 AND g_ig.etat = 3
GROUP BY g.ref_article
For this query I get:
ref_article gifts_number
1903 3
The problem is that I want to get all id_gift for this ref_article for my example : 100455,100456,100457
Is it possible to do in a single query?