1 Resposta
- Mais recentes
- Mais votos
- Mais comentários
1
I was able to achieve the results you expected with a different SQL. Kindly see if this will help your use case.
create table tst_ordr
( ID NUMERIC,
tmstmp TIMESTAMP
);
INSERT INTO tst_ordr values
(1001,'2023-10-01 08:00:00'),
(1002,'2023-10-01 08:00:00'),
(1002,'2023-10-01 08:30:00'),
(1002,'2023-10-01 09:00:00'),
(1003,'2023-10-01 08:00:00'),
(1003,'2023-10-01 08:15:00'),
(1003,'2023-10-01 08:30:00'),
(1003,'2023-10-01 08:45:00'),
(1004,'2023-10-01 08:30:00')
;
select *,
row_number()
over (partition by id
order by ID, tmstmp)
as "Order"
from tst_ordr
order by 1,3;
respondido há 7 meses
Conteúdo relevante
- AWS OFICIALAtualizada há 9 meses
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 3 meses
Thank you!! This is exactly what I was looking for!