I have 2 tables: SALES table and CUSTOMER table.
The SALES table contains inconsistent customer name. I need to assign a key to the customer in the SALES table based on the CUSTOMER table.
I would like to update the SALES.customerID field = to the CUSTOMER.customerID field. I wrote this query but it doesn't work because the subquery is returning more than 1 value.
update CUSTOMER
set customerID=(select customerID from CUSTOMER)
where CUSTOMER.CustomerName=(select CustomerName from CUSTOMER)
To explain further, the Customer table contains customer names with the same customer ID. Example:
CustomerName CustomerID
ABC 1
ABC Inc 1
ABC, Inc. 1
Atlas Inc. 2
Atlas Corp, Inc. 2
The Sales table customer name is entered many different ways for the same customer.
Please help... Thank you very much.
The SALES table contains inconsistent customer name. I need to assign a key to the customer in the SALES table based on the CUSTOMER table.
I would like to update the SALES.customerID field = to the CUSTOMER.customerID field. I wrote this query but it doesn't work because the subquery is returning more than 1 value.
update CUSTOMER
set customerID=(select customerID from CUSTOMER)
where CUSTOMER.CustomerName=(select CustomerName from CUSTOMER)
To explain further, the Customer table contains customer names with the same customer ID. Example:
CustomerName CustomerID
ABC 1
ABC Inc 1
ABC, Inc. 1
Atlas Inc. 2
Atlas Corp, Inc. 2
The Sales table customer name is entered many different ways for the same customer.
Please help... Thank you very much.