How to identify in-between steps based on timestamp

Analytics
Junior Contributor

Re: How to identify in-between steps based on timestamp

Why do you add both DISTINCT & GROUP BY, both do the same. I don't know if you actually need it for the 1st Select, but you definitely don't need it in the final Select.

Enthusiast

Re: How to identify in-between steps based on timestamp

yes, group by and distinct are both work on the same. the reason why I try to do group is, the order_name could start from 1 for the first ID and sequence of steps, and end at 115 for example, but for the second ID, it will start from like 115 again, which is not I want, I want it to always start from 1 for each ID.

Junior Contributor

Re: How to identify in-between steps based on timestamp

There's no Group By for OLAP-functions, you need to add Partition By:

Over (PARTITION BY lotid ORDER BY RUNCOMPLETEDATETIME