with prices as (select date(block_timestamp) as day, avg(rune_usd) as price from thorchain.prices
group by day )
select * from
(select date(block_timestamp) as day_, sum(from_amount_usd) as swap_amt_usd from thorchain.swaps
where to_asset like '%RUNE%'
group by day_)
inner join prices
on day = day_