0

i have two tables named newlab and deadstock both are in same database and i want to copy some of the fields of newlab to deadstock for that i am using the follwing code

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."';

but it gives operand should contain one column error

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828

1 Answers1

0

Try this code

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."';
Up_One
  • 5,213
  • 3
  • 33
  • 65