0
what should change in my consultation
WITH Consulta AS
(SELECT DT_RFRN_MVMN,
TX_DATA_VNDA,
CD_BNDR,
CD_CRDE,
CD_PCSR CD_EMSR,
CD_TIPO_PLTF_PGMN,
CD_TIPO_TRNS_BNDR_RECB,
CD_TIPO_APRS_TRNS_RECB,
CD_PRDT_BNDR_RECB,
numerolinha= row_number() over (partition BY CD_PRDT_BNDR_RECB order by CD_CRDE DESC)
FROM CLC.TBCLCR_LNCM_RECB
)
SELECT DT_RFRN_MVMN,
TX_DATA_VNDA,
CD_BNDR,
CD_CRDE,
CD_PCSR CD_EMSR,
CD_TIPO_PLTF_PGMN,
CD_TIPO_TRNS_BNDR_RECB,
CD_TIPO_APRS_TRNS_RECB,
CD_PRDT_BNDR_RECB
FROM Consulta
WHERE numerolinha = 1;
To bring the result grouped by CD_PRDT_BNDR_RECB