您好我正在尝试创建一个基于相同变量的新表。下面是我试图让它发挥作用,我也试过了其他几个。
我必须创建一个表格,其中x和x1并排。当我尝试单独插入时,我得到一个看起来像
的表x |空
x |空
null | X1
null | X1
我想要一张结果为
的表格x | X1
x | X1
insert into inter
(
x,
x1
)
select
unrolled.`Sum of New Lds` from unrolled where pastdate(`Week end`)='2014-06-08',
(select unrolled.`Sum of New Lds` from unrolled where `Week end`='2014-06-08')
答案 0 :(得分:0)
语法为:
INSERT INTO TableName (ColumnX1, ColumnX2) VALUES ('x1', 'x2')
如果由于某种原因需要在2个单独的语句中执行此操作,则无法插入现有行,因为您需要更新,例如
UPDATE TableName SET ColumnX2='X2' WHERE ColumnX1 = 'x1'