문제

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

도움이 되었습니까?

해결책

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;

다른 팁

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top