Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01179984
Message ID:
01180096
Views:
25
John,

If you want donated to both then we need to tweak Sergie's code;
SELECT * FROM Contributuions
	WHERE Official = @Official1 AND Contributor IN (
		SELECT Contributor FROM Contributuions
		WHERE official = @Official2
		GROUP BY 1
		HAVING COUNT(*) > 1
				)
>>>Ok, this is making my head hurt. I've got a flat file that has campaign donation data from our local elected officials. I want to identify anyone who made a contribution to two officials. I want the users to be able to pick two officials and then run a select statement that will pull out all the people who have donated to both. I have tried unions, left outer, right outer, inner joins, etc. - nada.
>>>
>>>I would like a result set that only has four columns official, contributor, date, amount. One of you SQL gurus who does this all day, every got any ideas?
>>
>>Hi 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!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform