# 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;"
# 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;"
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