update by partition

sql update top 5

1
2
3
4
5
6
7
8
9
SELECT
ROW_NUMBER() OVER (PARTITION BY col1, col2
ORDER BY x desc) AS r,
t.id
FROM
some_table t
where condition = 'xxx'
) A
where A.r < 5;

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!