Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in Find Duplicates query

Status
Not open for further replies.

solun

Programmer
Apr 1, 1999
55
I used the find duplicates query wizard and it gives me this error: "You tried to execute a query that does not include the specified expression " as part of an aggregate function." (Yes, that's simply a quotation mark in the error msg.)


in SQL view:

SELECT [Blossburg Active Voters].NameCondensed, [Blossburg Active Voters].Voter_Status, [Blossburg Active Voters].Political_Party, [Blossburg Active Voters].Last_Name, [Blossburg Active Voters].MailingCSZ
FROM [Blossburg Active Voters]
GROUP BY [Blossburg Active Voters].MailingAddress, [Blossburg Active Voters].NameCondensed, [Blossburg Active Voters].Voter_Status, [Blossburg Active Voters].Political_Party, [Blossburg Active Voters].Last_Name, [Blossburg Active Voters].MailingCSZ
HAVING ((([Blossburg Active Voters].MailingAddress) In (SELECT [MailingAddress] FROM [Blossburg Active Voters] As Tmp GROUP BY [MailingAddress] HAVING Count(*)>1 )));
 
Try deleting this part
Code:
...HAVING ((([Blossburg Active Voters].MailingAddress) In (SELECT [MailingAddress] FROM [Blossburg Active Voters] As Tmp GROUP BY [MailingAddress]
,,,


Instead do this
Code:
SELECT [Blossburg Active Voters].NameCondensed, 
            [Blossburg Active Voters].Voter_Status, 
            [Blossburg Active Voters].Political_Party, 
            [Blossburg Active Voters].Last_Name, 
            [Blossburg Active Voters].MailingCSZ
FROM [Blossburg Active Voters]
GROUP BY [Blossburg Active Voters].MailingAddress,
                [Blossburg Active Voters].NameCondensed,
                [Blossburg Active Voters].Voter_Status,
                [Blossburg Active Voters].Political_Party, 
                [Blossburg Active Voters].Last_Name, 
                [Blossburg Active Voters].MailingCSZ
HAVING Count(*)>1 ;

Are you sure you want to group by mailing address? That data is hugely inconsistent, one space will make it a different address.
 
Actually, it worked pretty well - the data is surprisingly consistent b/c it's generated by the county (state??) election database and there are four fields for the street address alone (house #, house # suffix, complete street name, apartment).

Thanks for your help!

Heidi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top