Query editor
WITH added AS (SELECT custodian, evt_block_time AS added_atFROM ethena_labs_ethereum.ethenaminting2_evt_custodianaddressaddedUNION ALLSELECT custodian, evt_block_time AS added_atFROM ethena_labs_ethereum.ethenaminting_evt_custodianaddressadded),removed AS (SELECT custodian, evt_block_time AS removed_atFROM ethena_labs_ethereum.ethenaminting2_evt_custodianaddressremovedUNION ALLSELECT custodian, evt_block_time AS removed_atFROM ethena_labs_ethereum.ethenaminting_evt_custodianaddressremoved)SELECT DISTINCTa.custodian,a.added_at,r.removed_at,CASEWHEN r.custodian IS NULL THEN 'active'ELSE 'removed'END AS statusFROM added aLEFT JOIN removed r ON a.custodian = r.custodianORDER BY status, a.added_at DESC