]> gitweb.pimeys.fr Git - scripts-20-100.git/blobdiff - bde/old/integrite/memo
[bde] Rangement
[scripts-20-100.git] / bde / old / integrite / memo
diff --git a/bde/old/integrite/memo b/bde/old/integrite/memo
new file mode 100644 (file)
index 0000000..f7519c1
--- /dev/null
@@ -0,0 +1,7 @@
+# pour créer la table numcbde,gagne,perdu,effectif :
+
+SELECT numcbde,(SELECT sum(montant*quantite) FROM transactions WHERE destinataire=main.numcbde AND valide='t') as gagne,(SELECT sum(montant*quantite) FROM transactions WHERE emetteur=main.numcbde AND valide='t') as perdu, (SELECT solde FROM adherents WHERE numcbde=main.numcbde) as effectif FROM adherents as main;
+
+# et créer la table + en extraire seulement les gens intéressants :
+# NB : c'est long à exécuter...
+SELECT numcbde,gagne-perdu,effectif FROM (SELECT numcbde,(SELECT sum(montant*quantite) FROM transactions WHERE destinataire=main.numcbde AND valide='t') as gagne,(SELECT sum(montant*quantite) FROM transactions WHERE emetteur=main.numcbde AND valide='t') as perdu, (SELECT solde FROM adherents WHERE numcbde=main.numcbde) as effectif FROM adherents as main) AS calculs WHERE gagne-perdu!=effectif;