Question

I'm having a verry strange problem. I am certain I have done nothing wrong in this line of code:

INSERT INTO 
 oc_address     
  (`cust_id`, `firstname`, `lastname`, `address_1`, `city`, `postcode`, `country_id`)
SELECT          
  (`cust_id`, `first_name`, `last_name`, `address`, `city`, `postalcode`, `country`)
FROM    old_customer;

Still I get the message "#1241 - Operand should contain 1 column(s)"

Does anybony see something I don't see? I was thinking it may be caused by the _1 at address_1. But why would that be... I hope there is another explanation

Was it helpful?

Solution

remove ( ) around the columns on SELECT ststement,

INSERT  INTO oc_address (cust_id, firstname, lastname, address_1, city, postcode, country_id)
SELECT cust_id, first_name, last_name, address, city, postalcode, country
FROM    old_customer;

OTHER TIPS

Remove the ' symbols for your column names and the () in your SELECT.

  INSERT INTO 
  oc_address     
  (cust_id, firstname, lastname, address_1, city, postcode,country_id)
  SELECT          
  cust_id, first_name, last_name, address, city, postalcode, country
  FROM    old_customer;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top