Query editor
WITH events AS (SELECTevt_block_time,evt_tx_hash,"_user" AS address,'blacklisted' AS statusFROM tether_tron.tether_usd_evt_addedblacklistUNION ALLSELECTevt_block_time,evt_tx_hash,"_user" AS address,'removed' AS statusFROM tether_tron.tether_usd_evt_removedblacklist),latest_status AS (SELECTaddress,MAX_BY(status, evt_block_time) AS current_status,MAX(evt_block_time) AS latest_event_timeFROM eventsGROUP BY 1)SELECTCOUNT(*) AS total_ever_blacklisted,COUNT_IF(current_status = 'blacklisted') AS currently_blacklisted,COUNT_IF(current_status = 'removed') AS removed_from_blacklistFROM latest_status;