Query editor
WITHregs AS (SELECTcall_success, call_block_number, secret, durationFROMethereumnameservice_ethereum.ETHRegistrarController_4_call_registerWHEREcall_success = trueANDcall_block_number > 16596477UNION ALLSELECTcall_success, call_block_number, secret, durationFROMethereumnameservice_ethereum.ETHRegistrarController_3_call_registerWithConfigWHEREcall_success = trueANDcall_block_number > 16596477UNION ALLSELECTcall_success, call_block_number, secret, durationFROMethereumnameservice_ethereum.ETHRegistrarController_3_call_registerWHEREcall_success = trueANDcall_block_number > 16596477),app_ids_table AS (SELECTapp_id,durationFROMregs,LATERAL (SELECT to_hex(substr(secret, 1, 4)) AS app_id)),counts_with_groups AS (SELECTapp_id,COUNT(*) AS occurrences,SUM(duration) AS total_duration_secondsFROMapp_ids_tableGROUP BYapp_idHAVINGCOUNT(*) > 1),counts AS (SELECTapp_id,occurrences,total_duration_seconds,(total_duration_seconds / (60 * 60 * 24 * 365.25)) AS total_duration_yearsFROMcounts_with_groupsUNION ALL