I have the following scenario: a table with these columns:
table_id|user_id|os_number|inclusion_date
On the system, os_number is consistent for users, but due to a system error, some users inserted the OS in the wrong order. Something like that:
table_id | user_id | os_number | inclusion_date ----------------------------------------------- 1 | 1 | 1 | 2015-11-01 2 | 1 | 2 | 2015-11-02 3 | 1 | 3 | 2015-11-01
- Note the os 3 number inserted before the os 2 number
What I need:
Restore table_id of rows 2 and 3, which is out of order.
I have two choices that show me table_id in two different orders:
select table_id from table order by user_id, os_number select table_id from table order by user_id, inclusion_date
I canβt understand how I can compare these two choices and see which users are affected by this system error.
sql postgresql
Wellington zanelli
source share