Created
August 16, 2021 16:42
-
-
Save elsangedy/f1238d481fab4a6e80705730c9b00cd0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update table1 t1 | |
set "order" = t2.seq | |
from ( | |
select id, row_number () over (partition by target_id order by created_at) as seq | |
from table2 | |
) as t2 | |
where t1.id = t2.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment