From: Vincent Le Gallic Date: Sat, 4 Apr 2015 23:15:20 +0000 (+0200) Subject: Mise à jour des scripts de stats de la bade bde vers la base note X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=226838d356055b72d63e61e3ace5e166cbde8eb8;p=scripts-20-100.git Mise à jour des scripts de stats de la bade bde vers la base note --- diff --git a/bde/stats/consos.sh b/bde/stats/consos.sh index cc130f4..bf11e17 100755 --- a/bde/stats/consos.sh +++ b/bde/stats/consos.sh @@ -3,4 +3,4 @@ # Affiche (par ordre décroissant d'occurrence) # le nombre de chaque conso effectuées par un comte -psql bde -c "SELECT remarque, SUM(quantite) AS qte FROM transactions WHERE $1 in (emetteur, destinataire) AND valide GROUP BY remarque ORDER BY qte DESC;" +psql note -c "SELECT description, SUM(quantite) AS qte FROM transactions WHERE $1 in (emetteur, destinataire) AND valide GROUP BY description ORDER BY qte DESC;" diff --git a/bde/stats/record.sh b/bde/stats/record.sh index ba9ed78..321f3b7 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 bde -c "SELECT t.remarque, a.nom, a.prenom, a.pseudo, SUM(t.quantite) AS qte FROM transactions AS t, adherents AS a WHERE remarque ILIKE '$1' AND a.numcbde=t.emetteur AND valide GROUP BY t.remarque, a.nom, a.prenom, a.pseudo ORDER BY qte DESC;" +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;" diff --git a/bde/stats/soldes.sh b/bde/stats/soldes.sh index 37d9a71..027056c 100755 --- a/bde/stats/soldes.sh +++ b/bde/stats/soldes.sh @@ -4,8 +4,8 @@ if [[ "$1" = "--no-club" ]] then - psql bde -c "SELECT nom, prenom, pseudo, solde FROM adherents WHERE NOT club ORDER BY solde DESC;" + psql note -c "SELECT nom, prenom, pseudo, solde FROM comptes WHERE type!='club' ORDER BY solde DESC;" else - psql bde -c "SELECT nom, prenom, pseudo, solde FROM adherents ORDER BY solde DESC;" + psql note -c "SELECT nom, prenom, pseudo, solde FROM comptes ORDER BY solde DESC;" fi