peteer14merry
    Updated 2023-01-12
    with ethereum_table as
    (
    select price as eth_price , to_date(hour) as eth_price_date from ethereum.core.fact_hourly_token_prices
    where eth_price_date> CURRENT_DATE - interval '45 days' and token_address is null and hour(hour)=0
    )
    , near_table as
    (
    select max(price_usd) as near_prices , to_date(TIMESTAMP) as near_price_date from near.core.fact_prices
    where near_price_date > current_date - interval '45 days' and symbol='wNEAR' and hour(TIMESTAMP)=0
    group by near_price_date
    )

    select eth_price,near_prices,eth_price_date from ethereum_table
    inner join near_table
    on eth_price_date=near_price_date