I have an issue with related records, which I have posted here thread701-1397905 . I am thinking I need to do a loop or for each or something, but not sure how to do it. Can someone please assist me?
Right now I have this query built, but it only gives me each customer related to themselves, lol. I understand that that is what it says to do. I know what I want to do, but I don't know how to express it.
Any help is greatly appreciated.
Thank you.
misscrf
It is never too late to become what you could have been ~ George Eliot
Right now I have this query built, but it only gives me each customer related to themselves, lol. I understand that that is what it says to do. I know what I want to do, but I don't know how to express it.
Any help is greatly appreciated.
Thank you.
Code:
INSERT INTO tblRelated ( RMasterCustomerID, RelatedCustomerID )
SELECT Min(tblCustomers.ID) AS MinOfID, tblCustomers.ID
FROM tblCustomers LEFT JOIN tblAddress ON tblCustomers.ID = tblAddress.Vendor
WHERE (((tblCustomers.CustomerName) In (SELECT [CustomerName] FROM [tblCustomers] As Tmp GROUP BY [CustomerName],[Add1] HAVING Count(*)>1 And [Add1] = [tblAddress].[Add1])))
GROUP BY tblCustomers.ID;
misscrf
It is never too late to become what you could have been ~ George Eliot