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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query generating more than 1 identical record

Status
Not open for further replies.

Domino2

Technical User
Joined
Jun 8, 2008
Messages
475
Location
GB
I have a VB query that starts off with:

mysql = "SELECT StrConv(Concatenate(""SELECT DISTINCT Company FROM qryJC WHERE ID="" & [Business].[ID]),3)"

ie there are other fields that follow above line.
However I think the query contained qryJC keeps running the above mysql query each time it concantenates the field company.

The query qryJC is:
SELECT Junction.ID, Companies.Company AS Expr1
FROM Companies INNER JOIN Junction ON Companies.CompanyID = Junction.CompanyID;

Can anyone confirm this is the case, I think it is as the same number of records which are identicle are related to the number of records being dealt with in concanenation.

Thanks
 
why not this:
Code:
mysql = "SELECT StrConv(Concatenate(""SELECT DISTINCT Company FROM [b]JUNCTION[/b] WHERE ID="" & [Business].[ID]),3)"

Leslie

Have you met Hardy Heron?
 
Thanks, however it still produces duplicates. I have checked the tables and there is only i with ID=2004, it has 4 company names, so it produces 4 records exactly the same.
 
Provide the total SQL statement that incudes the Concatenate function. I expect your query includes the child/junction table that is shouldn't.

Duane
Hook'D on Access
MS Access MVP
 
I have put the DISTINCT statement in the front ie DISTINCT strConv etc and that has fixed it. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top