S
Stapes
Hi
I tried running this query where TM_Customers table might have more
than one match on it, but I only want one record output, so I set URN1
to indexed - no duplicates, this being unique to each record on the
input.
INSERT INTO TTEmp_AllForPostCodeCheck ( PK_Comp, URN1, [School Name],
Co, [Address 1], Add1, [Address 2], Add2, Pocd, Postcode, TOG_OK )
SELECT TM_Customers.PK_Comp, TTemp_TextImport.[School URN],
TTemp_TextImport.[School Name], TM_Customers.Co, TTemp_TextImport.
[Address 1], TM_Customers.Add1,TTemp_TextImport.[Address 2],
TM_Customers.Add2, TM_Customers.Pocd, TTemp_TextImport.Postcode, 0
FROM TTemp_TextImport INNER JOIN TM_Customers ON
TTemp_TextImport.Postcode = TM_Customers.Pocd;
The query returned no records - just an error message:
3022 The changes you requested to the table were not successful
because they would create duplicate values in the index...
How can I get it to just select the first TM_Customer record that
matches each TTemp_TextImport record?
Stapes
I tried running this query where TM_Customers table might have more
than one match on it, but I only want one record output, so I set URN1
to indexed - no duplicates, this being unique to each record on the
input.
INSERT INTO TTEmp_AllForPostCodeCheck ( PK_Comp, URN1, [School Name],
Co, [Address 1], Add1, [Address 2], Add2, Pocd, Postcode, TOG_OK )
SELECT TM_Customers.PK_Comp, TTemp_TextImport.[School URN],
TTemp_TextImport.[School Name], TM_Customers.Co, TTemp_TextImport.
[Address 1], TM_Customers.Add1,TTemp_TextImport.[Address 2],
TM_Customers.Add2, TM_Customers.Pocd, TTemp_TextImport.Postcode, 0
FROM TTemp_TextImport INNER JOIN TM_Customers ON
TTemp_TextImport.Postcode = TM_Customers.Pocd;
The query returned no records - just an error message:
3022 The changes you requested to the table were not successful
because they would create duplicate values in the index...
How can I get it to just select the first TM_Customer record that
matches each TTemp_TextImport record?
Stapes