Query editor
SELECTdate,chain,slug,SUM(native_tvl_usd + canonical_tvl_usd + external_tvl_usd) AS overall_tvlFROM dune.offchainlabs.result_l2_orbit_chain_tvlWHERE date >= current_date - interval '91' dayGROUP BY 1, 2, 3-- UNION ALL-- SELECT-- chain,-- slug,-- SUM(native_tvl_usd + canonical_tvl_usd + external_tvl_usd) AS overall_tvl-- FROM dune.offchainlabs.result_l3_orbit_chain_tvl-- WHERE date = current_date - interval '1' day-- GROUP BY 1, 2-- UNION ALL-- -- This will add a total row-- SELECT-- date,-- 'total' AS chain,-- 'total' AS slug,-- SUM(native_tvl_usd + canonical_tvl_usd + external_tvl_usd) AS overall_tvl-- FROM (-- SELECT date, native_tvl_usd, canonical_tvl_usd, external_tvl_usd-- FROM dune.offchainlabs.result_l2_orbit_chain_tvl-- WHERE date >= current_date - interval '91' day-- )-- group by 1,2,3-- UNION ALL-- SELECT native_tvl_usd, canonical_tvl_usd, external_tvl_usd-- FROM dune.offchainlabs.result_l3_orbit_chain_tvl-- WHERE date = current_date - interval '1' dayORDER BY overall_tvl DESC-- with calculated_balance as (-- with changed_balances as (-- select-- blockchain-- ,day-- ,a.address-- ,token_symbol-- ,token_address-- ,token_standard-- ,token_id-- ,balance_raw-- ,lead(cast(day as timestamp)) over (partition by token_address,a.address,token_id order by day asc) as next_update_day-- from tokens_ethereum.balances_daily_agg a-- where day >= date('2021-07-01') and token_standard in ('native', 'erc20')-- and a.address IN (-- 0x73c6af7029e714dff1f1554f88b79b335011da68, --hychain-- 0x7983403dda368aa7d67145a9b81c5c517f364c42, -- gravity