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 derfloh 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
Jun 8, 2008
475
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
 
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.
 
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