2015-09-08 92 views
0

我做了一個SELECT查詢是這樣的:INSERT INTO每個SELECT返回

SELECT field1, field2 FROM table1 WHERE (field1 IS NOT NULL AND field2 IS NOT NULL) 

它返回2列(該表沒有主鍵),現在我想將數據插入到另一查詢返回每一行的表(帶有附加數據)。

回答

2
insert into some_table (col1, col2, col3) 
SELECT field1, field2, 'additional data' 
FROM table1 
WHERE field1 IS NOT NULL AND field2 IS NOT NULL 
+0

非常感謝! – vanamees