我需要在另一个表的2列中插入10列(5对)。我尝试了很多方法:
SELECT device_id,
event_time,
unix_time,
event_id,
lag(event_time) OVER (PARTITION BY device_id ORDER BY unix_time,event_id) AS lag_time
FROM ios_d_events;
所有a,b列都来自相同的数据类型
答案 0 :(得分:3)
如果您想避免重复,可以使用UNION ALL
或UNION
。
insert into table1(a,b)
select a1,b1 from table2
UNION ALL
select a2,b2 from table2;
的 LiveDemo
强>