【发布时间】:2014-02-08 06:12:50
【问题描述】:
我正在尝试通过 sql 查询插入多行
场景是这样的:
1 testID 有多个属性,我想通过提供 TestID 将一个测试的属性复制到另一个测试这是我正在尝试的查询,但它根本不起作用
INSERT INTO dc_tp_attributes
(Attribute_name,acronym,active,description,testId,
subdepartmentid,
DOrder,Attribute_type,D_A_formula,D_A_formula_desc,
Linesno,DefaultValue,interfaced,ClientID,Enteredby,
Enteredon,drived,parentid,heading,print,interfaceid)
select Attribute_name,acronym,active,description,
635,subdepartmentid,DOrder,Attribute_type,D_A_formula,
D_A_formula_desc,Linesno,DefaultValue,interfaced,
ClientID,Enteredby,Enteredon,drived,parentid,
heading,print,interfaceid
FROM dc_tp_attributes
Where testid=877
这里我将testID=877的属性复制到testID=635,ID为877的测试有10个属性,而testID 635的测试只有1个。
有一个名为 AttributeID 的 Autoincrement Primery Key,错误是
"Field 'AttributeID' doesn't have a default value"
【问题讨论】:
标签: mysql sql batch-insert