db2 select 查询与分区

db2 select query with between and partition

我需要一些关于这个查询的帮助

SELECT UNIDADE, MATRICULA, NOME, CURSO, ESCOLA, DTATU, HRATU, STATUS,ROW_NUMBER() OVER(ORDER BY NOME) AS CONT FROM (

SELECT * FROM (SELECT ROW_NUMBER() OVER (PARTITION BY MATRICULA ORDER BY DTATU DESC,HRATU DESC) 作为 RN,
row_number() OVER ( ORDER BY NOME ) AS rid, UNIDADE, MATRICULA, NOME, CURSO, ESCOLA, DTATU, HRATU, STATUS FROM MOV_PROTOCOLO WHERE MATRICULA!='' ) AS t WHERE MATRICULA!= 来源''and RN = 1) as V WHERE V.CONT BETWEEN 0 AND 10

我想select此查询在 0 到 10 行之间!

类似的东西

放置代码状态(续)

001 41309014 确定 1
001 31121810 好 2
001 41309634 好 3
001 31414303 好的 4
001 41461487 确定 5
001 41207203 确定 6
001 41444868 好的 7
001 31344046 好的 8
001 41447131 好 9
001 41083326 好 10

我猜你是这个意思

SELECT UNIDADE, MATRICULA, NOME, CURSO, ESCOLA, DTATU, HRATU, STATUS
FROM (
    SELECT t.*, ROW_NUMBER() OVER (ORDER BY NOME) AS rid
    FROM (
        SELECT ROW_NUMBER() OVER (PARTITION BY MATRICULA ORDER BY DTATU DESC,HRATU DESC) AS RN,
            UNIDADE, MATRICULA, NOME, CURSO, ESCOLA, DTATU, HRATU, STATUS
        FROM MOV_PROTOCOLO
        WHERE MATRICULA!=''
    ) AS t
    WHERE t.RN = 1
) as V
WHERE V.rid BETWEEN 1 AND 10