Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Statement
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01179984
Message ID:
01180057
Vues:
25
>Hi John,
>
>You didn't mention before that there are possible multiple contribution per name and official combination.
>Here's a query that works on your test data. The new inner subquery gets unique combinations of name&official for specified criteria. The rest is the same as before.
>SELECT name, amount, official, date FROM cmoney ;
>	WHERE official IN (?Official1, ?Official2) ;
>		AND name IN ( ;
>			SELECT name FROM ( ;
>					SELECT name, official FROM cmoney ;
>			              WHERE official = ?Official1 or official = ?Official2 ;
>			             GROUP BY 1,2 ) ds1 ;
>			             GROUP BY 1 HAVING COUNT(*) > 1 ;
>             	) ;
>
>
Once more, let it be said far and wide - Sergey is the SQL Man!

Thanks Sergey it works wonderfully! This will be a keeper snippet.

John
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform