我有一条select语句,它获取100行数据并将其插入表中。但是,我想插入以将1
插入到我已插入到相邻列中的所有行的另一列中。在列中为相邻列的所有行插入一个相同的值
这是我的插入select语句
insert into examination_data (ed_cs_id,ed_examination_id)
VALUES ((
select cs_id
from class_students
where cs_class_id = 1 AND cs_year_id = 1),1);
运行查询,我得到这个错误
/* SQL错误(1242):子查询返回多个1行*/
你可以找到答案,你的quesiton这里: http://stackoverflow.com/questions/5391344/insert-with-select – Wirus
首先,当u试图插入一个表,删除关键词'VALUES',其次,你要插入的列数与查询中的列数不匹配。 –