mysql操作数应包含1列

时间:2014-03-26 18:37:46

标签: mysql mysql-error-1241

我有两个名为newlabdeadstock的表都在同一个数据库中 我想将newlab的一些字段复制到deadstock,因为我正在使用以下代码

INSERT INTO deadstock
(MAC,Lab_Code,PC_Name,Purchase_Order_No,
Brand,Model,Price,Processor,Ram,HDD,HDD_Type) 
SELECT (MAC,Lab_Code,PC_Name,Purchase_Order_No,
Brand,Model_Name,Price,Processor,Ram,HDD,HDD_Type)
FROM newlab WHERE PC_Name='".$PC_Name."';

但它给操作数应该包含一个列错误

1 个答案:

答案 0 :(得分:0)

试用此代码

INSERT INTO deadstock
(MAC,Lab_Code,PC_Name,Purchase_Order_No,
Brand,Model,Price,Processor,Ram,HDD,HDD_Type) 
SELECT MAC,Lab_Code,PC_Name,Purchase_Order_No,
Brand,Model_Name,Price,Processor,Ram,HDD,HDD_Type
FROM newlab WHERE PC_Name='".$PC_Name."';