0
点赞
收藏
分享

微信扫一扫

PGSQL 错行,上下行,前后行计算


错两行

select lag(name,-2,'乱七八糟的空替换字符串')  over(order by id) as las,* from sgdd

错行更新当前字段的值

update sgdd set name=z.las from(select lag(name,-2,'乱七八糟的空替换字符串')  over(order by id) as las,* from sgdd) z where z.id=sgdd.id

 

这个语句之宝贵啊

我搜了好久才回忆起来

举报

相关推荐

0 条评论