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:
01179987
Vues:
15
Sergey,

Here is my select statement and it is giving me more elected officials than it should.
SELECT name,amount,official,date FROM cmoney WHERE name IN (SELECT name FROM cmoney ;
WHERE (official = ?Official1 or official = ?Official2 );
GROUP BY 1 HAVING COUNT(*) > 1)
I only want records which include (name) contributor who gave to both officials.

john doe,1/1/99,1000.00,A.Politician
john doe,12/4/98,500.00,B.Politician

Above is a simplification of how the result set should look.


Thanks,

John



>>
>>Try
>>SELECT * FROM Contributuions
>>	WHERE Contributor IN (
>>		SELECT Contributor FROM Contributuions
>>		WHERE official = @Official1 or official = @Official2
>>		GROUP BY 1
>>		HAVING COUNT(*) > 1
>>				)
>
>Somehow, I figured you'd be the one to come up with the answer within a few milliseconds!<g>
>
>Thanks Sergey!
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