2
Hello,
In a given relationship table I have a column that stores the ordering, but due to a problem in the application this column was populated wrong data, as the example
|user_log
-------------------------------------------
|user_id |log_id |seq_num| created_date |
-------------------------------------------
|175300 |368501 |0 |
|175300 |368502 |0 |
|175300 |368503 |0 |
|175336 |368504 |0 |
|175389 |368505 |0 |
|175389 |368506 |0 |
I need to create an sql script, which corrects this ordering by populating the seq_num column with the order of creation, determined by the created_date column. Example:
-------------------------------------------
|user_id |log_id |seq_num| created_date |
-------------------------------------------
|175300 |368501 |0 |
|175300 |368502 |1 |
|175300 |368503 |2 |
Does anyone have an idea of how to build this sql script? NOTE: the database is Oracle.
your created_date field has no value? is datetime?
– Marco Souza
the created_date column is always populated with the date of the Insert, not put in the example, sorry.
– Eduardo dos S Barbieri