E
Ernst Guckel
Hi,
Maybe i am going about this all wrong... I have a CSV file that has 167
records in it. In each record there is a company name, a contact name and
other data... i am trying to create 2 append queries... one that appends the
company data to tblCompanies and another to append contact data to
tblContacts... they are linked via the CompanyID... my append query adds ALL
company records... even if there are more than one contact per conpany. I
just want one company added. Then the contacts can be added to the contacts
table with an innor join?? to the tblContacts...
Here is the select query i am using to get the right data to show up but I
want Distinct for "CompanyBusinessName, Address1, Address2, City, State, and
Zip"
and i want other fields to populate as well but for the first occurance...
i dont want them to be used in the "Distinct" key work.. Here is what I
have...
Any help would be great...
SELECT DISTINCT tblA.CardScanData.Company, tblA.CardScanData.Address1,
tblA.CardScanData.Address2, tblA.CardScanData.City, tblA.CardScanData.Zip
FROM (SELECT CardScanData.Company, CardScanData.Address1,
CardScanData.Address2, CardScanData.City, CardScanData.State,
CardScanData.Zip, CardScanData.[2ndAddress1], CardScanData.[2ndAddress2],
CardScanData.[2ndCity], CardScanData.[2ndState], CardScanData.[2ndZip],
CardScanData.MainPhone, CardScanData.WebPage FROM CardScanData) AS tblA;
Maybe i am going about this all wrong... I have a CSV file that has 167
records in it. In each record there is a company name, a contact name and
other data... i am trying to create 2 append queries... one that appends the
company data to tblCompanies and another to append contact data to
tblContacts... they are linked via the CompanyID... my append query adds ALL
company records... even if there are more than one contact per conpany. I
just want one company added. Then the contacts can be added to the contacts
table with an innor join?? to the tblContacts...
Here is the select query i am using to get the right data to show up but I
want Distinct for "CompanyBusinessName, Address1, Address2, City, State, and
Zip"
and i want other fields to populate as well but for the first occurance...
i dont want them to be used in the "Distinct" key work.. Here is what I
have...
Any help would be great...
SELECT DISTINCT tblA.CardScanData.Company, tblA.CardScanData.Address1,
tblA.CardScanData.Address2, tblA.CardScanData.City, tblA.CardScanData.Zip
FROM (SELECT CardScanData.Company, CardScanData.Address1,
CardScanData.Address2, CardScanData.City, CardScanData.State,
CardScanData.Zip, CardScanData.[2ndAddress1], CardScanData.[2ndAddress2],
CardScanData.[2ndCity], CardScanData.[2ndState], CardScanData.[2ndZip],
CardScanData.MainPhone, CardScanData.WebPage FROM CardScanData) AS tblA;