From: Vincent Le Gallic Date: Wed, 4 Jan 2017 15:54:43 +0000 (+0100) Subject: [bde] On peut maintenant fusionner Guinness et Guiness X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=6698cfaac70907dea8cfccf2167d3caad5b07bf7;p=scripts-20-100.git [bde] On peut maintenant fusionner Guinness et Guiness --- diff --git a/bde/stats/record.sh b/bde/stats/record.sh index 321f3b7..241af84 100755 --- a/bde/stats/record.sh +++ b/bde/stats/record.sh @@ -3,4 +3,4 @@ # 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;"