- WITH temptable AS (
- SELECT
- [模板id],
- [空间id],
- [整数],
- ROW_NUMBER() OVER (PARTITION BY [模板id], [空间id] ORDER BY [Details_ID] ASC) AS NewRowNum
- FROM
- [数据表1]
- )
- UPDATE yt
- SET yt.序号= rd.NewRowNum
- FROM
- [数据表1] yt
- INNER JOIN temptable rd ON yt.[模板id] = rd.[模板id] AND yt.[空间id] = rd.[空间id] AND yt.[Details_ID] = rd.[Details_ID]
-
复制代码 您好,sql我们也不是很擅长,在网上搜了一下,您可以试试上方的sql语句
|