2016-09-14

〔SQL〕一次重新設定流水序號 / UPDATE ROW_NUMBER()

範例:執行將依據指定排序條件,將特定欄位重設流水序號


WITH UT as (SELECT SCode, L, ROW_NUMBER() OVER (ORDER BY SCODE) as RN FROM SP03 WHERE sp02_scode=100) UPDATE UT SET L=RN
5 章老師的電腦小講堂: 〔SQL〕一次重新設定流水序號 / UPDATE ROW_NUMBER() 範例:執行將依據指定排序條件,將特定欄位重設流水序號 WITH UT as ( SELECT SCode , L , ROW_NUMBER () OVER ( ORDER BY SCODE ) as RN FROM SP03 WHERE sp0...
小講堂經過多次搬移,舊文章連結及內容較難整理~
大家可以新文章為主~
每篇文章後有代碼,任何文章問題可至FB小講堂用代碼提問唷~