Last active
December 28, 2015 23:48
-
-
Save rafaelbernard/7581186 to your computer and use it in GitHub Desktop.
Remover inscrições baseado em critério. Deve-se subsituir "trim(custom9) is not null" (meu critério escolhido) pelo critério da situação em que se encontrar.
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
-- zerando historico | |
select * | |
from tpt_registration | |
where trim(custom9) is not null; | |
select * from all_tables where table_name like '%ACTION%' AND OWNER='TP8'; | |
select * | |
from tpt_offering_action | |
where id in ( | |
select offering_action_id | |
from tpt_registration | |
where trim(custom9) is not null | |
); | |
select * | |
from tpt_oe_order_items | |
where reg_id in ( | |
select id | |
from tpt_registration | |
where trim(custom9) is not null | |
); | |
select * | |
from tpt_oe_order | |
where id in ( | |
select order_id | |
from tpt_oe_order_items | |
where reg_id in ( | |
select id | |
from tpt_registration | |
where trim(custom9) is not null | |
) | |
); | |
select * | |
from let_registration_module | |
where registration_id in ( | |
select id | |
from tpt_registration | |
where trim(custom9) is not null | |
); | |
delete from cnt_cmi_registration | |
where id in ( | |
select class_id | |
from tpt_registration | |
where trim(custom9) is not null | |
); | |
delete from let_registration_module | |
where registration_id in ( | |
select id | |
from tpt_registration | |
where trim(custom9) is not null | |
); | |
delete from tpt_oe_order_items | |
where reg_id in ( | |
select id | |
from tpt_registration | |
where trim(custom9) is not null | |
); | |
delete from tpt_oe_order | |
where id not in ( | |
select order_id | |
from tpt_oe_order_items | |
); | |
delete from tpt_offering_action | |
where id in ( | |
select offering_action_id | |
from tpt_registration | |
where trim(custom9) is not null | |
); | |
delete from tpt_registration | |
where trim(custom9) is not null; | |
COMMIT; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment