In order to understand why, I use the ROW_NUMBER analytic function
SELECT
elaboration_day,
row_number() over (partition by machine_id, location_type order by elaboration_day) rn,
location_type,
commercial_id,
warehouse_id
FROM
awp_machine
where elaboration_day >= to_date('01/01/2020', 'dd/mm/yyyy')
order by elaboration_day;
How you can see, the ROW_NUMBER, preserve the PARTITIONING and numerate in ordered way the days inside the partition.
It could be strange, but it's the (right) way the analytic function works.
Nessun commento:
Posta un commento