Query editor
WITH params AS (SELECT-- Epoch 3 starts at 2026-04-05 16:00 CETTIMESTAMP '2026-04-05 14:00:00' AS epoch0_start_utc,20 AS epoch_length_hours,3 AS epoch_start_number),all_card_calls AS (-- Combine all card call tablesSELECT 'Growth' AS card_type, call_success, call_block_time, call_tx_from AS player, tokenId FROM its_megaeth.growth_card_call_playUNION ALLSELECT 'Redistribution', call_success, call_block_time, call_tx_from, tokenId FROM its_megaeth.redistribution_card_call_playUNION ALLSELECT 'Aggression', call_success, call_block_time, call_tx_from, tokenId FROM its_megaeth.aggression_card_call_playUNION ALLSELECT 'Destruction', call_success, call_block_time, call_tx_from, tokenId FROM its_megaeth.destruction_card_call_playUNION ALLSELECT 'Heal', call_success, call_block_time, call_tx_from, tokenId FROM its_megaeth.heal_card_call_playUNION ALLSELECT 'Reflect', call_success, call_block_time, call_tx_from, tokenId FROM its_megaeth.reflect_card_call_play),epoch_scramble AS (SELECTCAST(FLOOR(date_diff('hour', p.epoch0_start_utc, c.call_block_time) / p.epoch_length_hours) + p.epoch_start_number AS BIGINT) AS epoch,c.call_success,COUNT(*) AS attemptsFROM all_card_calls cCROSS JOIN params pWHERE c.call_block_time >= p.epoch0_start_utcGROUP BY 1, 2)SELECTepoch,SUM(CASE WHEN call_success = true THEN attempts ELSE 0 END) AS successful_plays,SUM(CASE WHEN call_success = false THEN attempts ELSE 0 END) AS failed_plays,SUM(attempts) AS total_attempts,ROUND(100.0 * SUM(CASE WHEN call_success = false THEN attempts ELSE 0 END) / NULLIF(SUM(attempts), 0),2) AS failure_rate_pctFROM epoch_scrambleGROUP BY epochORDER BY epoch DESC;