SELECT inside INSERT INTO
This question already has an answer here:
你不需要values关键字
INSERT INTO mytable( aa,bb,cc )
SELECT a,b,c FROM xyz
INSERT INTO temp_table (temp_value) SELECT source_value FROM the_table WHERE condition_value = some_value And temp_condition = some_value_condition
You can try some like this basic structure
INSERT INTO temp_table (Value1,Value2,Value3)
SELECT field1, field2, field3
FROM the_table
WHERE condition_value = some_value
Remember have the same number of fields in your INSERT INTO
and your SELECT
.
上一篇: 如何将Redshift SELECT atribute保存到脚本变量中
下一篇: 在INSERT INTO内部选择