Created
October 1, 2019 14:07
-
-
Save kshakir/ab9d1fb386659f047a1740b362e41cff to your computer and use it in GitHub Desktop.
Delete From Union
This file contains 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
-- regular delete from union doesn't work | |
delete `METADATA_ENTRY` | |
from `METADATA_ENTRY` | |
where (`METADATA_ENTRY`.`WORKFLOW_EXECUTION_UUID` in | |
((select `WORKFLOW_EXECUTION_UUID` as x2 | |
from `WORKFLOW_METADATA_SUMMARY_ENTRY` | |
where `ROOT_WORKFLOW_EXECUTION_UUID` = 'aaaa') | |
union | |
(select 'aaaa' as x2))) | |
and (`METADATA_ENTRY`.`METADATA_KEY` like 'labels:%'); | |
-- adding an extra (select * from ... as x99) works‽ | |
delete `METADATA_ENTRY` | |
from `METADATA_ENTRY` | |
where (`METADATA_ENTRY`.`WORKFLOW_EXECUTION_UUID` in | |
(select * | |
from ((select `WORKFLOW_EXECUTION_UUID` as x2 | |
from `WORKFLOW_METADATA_SUMMARY_ENTRY` | |
where `ROOT_WORKFLOW_EXECUTION_UUID` = 'aaaa') | |
union | |
(select 'aaaa' as x2)) as x99) | |
) | |
and (`METADATA_ENTRY`.`METADATA_KEY` like 'labels:%'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment