Query editor
with erc20_tokens as (select *from query_3340302),/*References:- ERC20 | Token names: https://dune.com/queries/3340302- Docs: https://dune.com/docs/query/query-a-query/*/fee_currency_transactions as (selectfee_currency,count(*) as transaction_countfrom celo.transactionsgroup by fee_currencyorder by transaction_count desc),total_transactions as (select count(*) as total_transactionsfrom celo.transactions)/*References:- Fee Currency | Alternative fee currency transactions (transaction type 123): https://dune.com/queries/3294063*/SELECTCASEWHEN fee_currency_transactions.fee_currency IS NULL THEN 'CELO'ELSE erc20_tokens.nameEND AS fee_currency_name,fee_currency_transactions.transaction_count,( select count(*) from celo.transactions ) as total_transactions,CAST(fee_currency_transactions.transaction_count as double) / ( select count(*) from celo.transactions ) as percentage,/*** Casting to double, because SQL is performing integer division, which rounds to 0.* But if either the nominator or the denominator is a floating point number, it performs a floating point division.*/fee_currency_transactions.fee_currency as fee_currency_addressFROMfee_currency_transactionsLEFT JOINerc20_tokens ON fee_currency_transactions.fee_currency = erc20_tokens.addressORDER BYfee_currency_transactions.transaction_count DESC