Query editor
WITH added AS (SELECTaccount_to_add AS node_pubkey,account_registry AS registry_pubkey,call_block_time,call_tx_id,call_outer_instruction_indexFROM dtelecom_solana.registry_call_add_node_to_registryWHERE account_registry = '33KzU9A7GogkJxvGYuDRzzwykafMGH9vB2vWZvs9oJ2u'),removed AS (SELECTaccount_to_delete AS node_pubkey,account_registry AS registry_pubkey,call_block_time,call_tx_id,call_outer_instruction_indexFROM dtelecom_solana.registry_call_remove_node_from_registry),removed_after AS (SELECTa.node_pubkey,a.registry_pubkey,CASEWHEN EXISTS (SELECT 1FROM removed rWHERE r.node_pubkey = a.node_pubkeyAND r.registry_pubkey = a.registry_pubkeyAND (r.call_block_time, r.call_tx_id, r.call_outer_instruction_index)> (a.call_block_time, a.call_tx_id, a.call_outer_instruction_index))THEN 1 ELSE 0END AS is_removedFROM added a)SELECTCOUNT(*) AS nodes_currentFROM removed_afterWHERE is_removed = 0;