# Affiche par ordre décroissant les plus grand consommateur d'une conso
# La comparaison est faite avec un ILIKE, on peut donc utiliser % et _
-psql note -c "SELECT t.description, c.nom, c.prenom, c.pseudo, SUM(t.quantite) AS qte FROM transactions AS t, comptes AS c WHERE description ILIKE '$1' AND c.idbde=t.emetteur AND valide GROUP BY t.description, c.nom, c.prenom, c.pseudo ORDER BY qte DESC;"
+psql note -c "SELECT string_agg(DISTINCT t.description, ','), c.nom, c.prenom, c.pseudo, SUM(t.quantite) AS qte FROM transactions AS t, comptes AS c WHERE description ILIKE '$1' AND c.idbde=t.emetteur AND valide GROUP BY c.nom, c.prenom, c.pseudo ORDER BY qte DESC;"