in my database i have 2 tables. table1 i have ID and NAMES
table2 i have ID, IDASSOCIATION, QUANTITY
so i have 2 names in table1: john and tom
and in table2 i have 3 lignes john, 1 tom, 1 john, 1
nombre one is the quantity
in my result i want get
john = 2 and tom = 1
so i do this: sql = "SELECT t1.*, t2.IDASSOCIATION, (SELECT SUM(t2.id_qte) FROM associationdepotarticle t2 WHERE t1.fusiontable = t2.fusiontable GROUP BY t2.IDASSOCIATION) as id_qte FROM articletable t1, associationdepotarticle t2";
but i not get this:
john = 2 tom = 1
:(
why ? what i will do, i need correction please
Aucun commentaire:
Enregistrer un commentaire