I'm trying to group the rows by group in sqlserver and as a result I want to:
CICLO | CODFIL | CODITPROD | ROW 1 | 1 | 10 | 1 11 | 1 | 10 | 2 12 | 1 | 10 | 3 1 | 2 | 10 | 1 11 | 2 | 10 | 2 1 | 3 | 11 | 1 11 | 3 | 11 | 2
But my query returns me
CICLO | CODFIL | CODITPROD | ROW 1 | 1 | 10 | 1 11 | 1 | 10 | 1 12 | 1 | 10 | 1 1 | 2 | 10 | 1 11 | 2 | 10 | 1 1 | 3 | 11 | 1 11 | 3 | 11 | 1
Follow my query
SELECT CICLO,
CODFIL,
CODITPROD,
DENSE_RANK ()
OVER (PARTITION BY CODFIL, CODITPROD
ORDER BY CODFIL, CODITPROD )
AS ROW
FROM TABELA R WITH (NOLOCK)