X-Git-Url: http://gitweb.pimeys.fr/?a=blobdiff_plain;f=bde%2Fintegrite%2Fmemo;fp=bde%2Fintegrite%2Fmemo;h=f7519c1c9ff550713ae7e910a90c03bb7a037abb;hb=918f150099bd27adbae3dab6a208e6a188cdb514;hp=0000000000000000000000000000000000000000;hpb=249c4ceb0ec65b63ae0e7292066e2d88517d9e62;p=scripts-20-100.git diff --git a/bde/integrite/memo b/bde/integrite/memo new file mode 100644 index 0000000..f7519c1 --- /dev/null +++ b/bde/integrite/memo @@ -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;