select 'Optimism' as blockchain,
block_timestamp::date as date,
count (case when STATUS != 'SUCCESS' then 1 end) as Failed_TX,
count (case when STATUS = 'SUCCESS' then 1 end) as Success_TX,
(Failed_TX / (Success_TX + Failed_TX)) * 100 as Failure_Rate
from optimism.core.fact_transactions
group by 1,2
union ALL
select 'Ethereum' as blockchain,
block_timestamp::date as date,
count (case when STATUS != 'SUCCESS' then 1 end) as Failed_TX,
count (case when STATUS = 'SUCCESS' then 1 end) as Success_TX,
(Failed_TX / (Success_TX + Failed_TX)) * 100 as Failure_Rate
from ethereum.core.fact_transactions
group by 1,2