可以通过insert into …… as select 语句来进行实现。
sql:insert into tablename(newname) as select oldname from tablename where 条件语句。
备注:以上语句中插入的字段顺序必须要和查询的语句的顺序保持一致,否则会报错,如果有条件语句的话,可以增加 where条件。
update a ua set y_value=
(select y_value from (select id,x_value,lag(x_value)over(order by id) y_value from a ) sa
where ua.id=sa.id);
update a set y_value =(select x_value from a where stat_cycle='201404') where stat_cycle ='201405';