2014-10-03 66 views
0

嗨我想创建一个新的表,他们基于相同的变量。下面是我试图让它工作,我也尝试了其他一些瘦。插入语句使用多个where子句

我必须创建一个x和x1并排的表格。当我尝试单独插入时,我得到一张看起来像

x | null

x | null

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

的语法是:

INSERT INTO TableName (ColumnX1, ColumnX2) VALUES ('x1', 'x2') 

如果您需要做的是在出于某种原因2条独立的语句,你不能插入到现有行,为您要更新,像

UPDATE TableName SET ColumnX2='X2' WHERE ColumnX1 = 'x1' 
+0

嘿,假设x1和x是变量,这是否仍然有效? – seetler 2014-10-06 16:14:48

+0

是的。它的价值从何而来并不重要。 – 2014-10-07 15:03:44