Gavin_Yi

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

客户需要排序ID和页面的问题序号一致,以前删除过一些问题导致order_id 中间有些断开的.

业务表 T_QUESTION

 order_id question_id  custom_id

--1.创建视图,使用row_number()函数 根据客户分组
create view update_order_no as
select *, row_number()  over (partition by custom_id order by order_id asc) r
from T_QUESTION
--2.更新
update update_order_no set order_id = r


select * from update_order_no

  

posted on 2016-12-01 17:29  Gavin_Yi  阅读(470)  评论(0编辑  收藏  举报