id | c0 | c1 | username | version | is_deleted |
---|---|---|---|---|---|
6 | old0 | old1 | Kevin | 2 | t |
Created
September 2, 2022 03:12
-
-
Save unknowntpo/4b8e72e7fb2e34c9d97cd433a78ee0b0 to your computer and use it in GitHub Desktop.
db_version_control.deleted
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
with deleted as ( | |
select * from join_table | |
where temp_id is null and data_id is not null | |
) | |
insert into temp (c0, c1, username, version, is_deleted) | |
select c0, c1, 'Kevin', version+1, true | |
from data | |
where id in (select data_id from deleted); | |
select * from temp where is_deleted = true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment