有几种将数据插入表中的方法:
insert into MyTable (ColA, ColB, ColC) values ('A', 'B', 'C') insert into MyTable (ColA, ColB, ColC) select colAA, colBB, colCC from MyTable2
有没有办法使用,insert into MyTable (ColA, ColB, ColC) select colAA, colBB, colCC from MyTable2但我不想在colA中插入例如colAA值,而是总是将其插入1。
insert into MyTable (ColA, ColB, ColC) select colAA, colBB, colCC from MyTable2
感谢帮助
只需在SELECT列表中添加一个常量
SELECT
INSERT INTO MyTable (ColA, ColB, ColC) SELECT 1, colBB, colCC FROM MyTable2