I have a table like shown in picture. For a distinct combination of VALUE1 and VALUE2 Columns, i have several steps. So, I want a view showing the number of each step based on the order they arrive. For example, STEP1 arrives first and so it's step number in the view should be 1 and so on. Kindly heklp me on this aspect. Thanks in advance.
What you ask can pe done with:
select value1, value2, step, row_number() over (partition by value1, value2 order by rn)
from
(select value1, value2, step, rownum as rn
from table
--an order by recommended
)
But I strongly recommend to give an order by to the query. The "the order they arrive" is not an order in a DBMS.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments