Query editor
WITHerc721 as (select ROUND(SUM(t.amount_original)) as amount,SUM(CAST(number_of_items AS integer)) as items,MONTH(t.block_time) as month,YEAR(t.block_time) as yearfrom aavegotchi.trades twhere t.nft_contract_address = 0x86935f11c86623dec8a25696e1c19a8659cbf95d--and t.buyer = 0x1a08b4d6497fa6d5970bd8f6c72bc5fbc8dd500eand t.token_standard = 'erc721'and t.block_time >= CAST(From_iso8601_timestamp('2022-05-22T15:00:00Z') AS timestamp)group by MONTH(block_time), YEAR(t.block_time)order by YEAR(t.block_time), MONTH(block_time)),erc1155 as (select ROUND(SUM(t.amount_original)) as amount,SUM(CAST(number_of_items AS integer)) as items,MONTH(t.block_time) as month,YEAR(t.block_time) as yearfrom aavegotchi.trades twhere t.nft_contract_address = 0x86935f11c86623dec8a25696e1c19a8659cbf95d--and t.buyer = 0x1a08b4d6497fa6d5970bd8f6c72bc5fbc8dd500eand t.token_standard = 'erc1155'and t.block_time >= CAST(From_iso8601_timestamp('2022-05-22T15:00:00Z') AS timestamp)group by MONTH(block_time), YEAR(t.block_time)order by YEAR(t.block_time), MONTH(block_time)),ghst as (select month, year, usdfrom (VALUES(5, 2022, 1.506),(6, 2022, 1.327),(7, 2022, 1.344),(8, 2022, 1.258),(9, 2022, 1.181),(10, 2022, 1.130),(11, 2022, 1.070),(12, 2022, 0.976),(1, 2023, 1.147),(2, 2023, 1.455),(3, 2023, 1.173),(4, 2023, 1.104),(5, 2023, 0.978)) as t (month, year, usd))Selecterc721.amount as gotchi_amount,ROUND(erc721.amount * ghst.usd) as gotchi_amount_usd,erc721.items as gotchi_volume,erc1155.amount as wearable_amount,ROUND(erc1155.amount * ghst.usd) as wearable_amount_usd,erc1155.items as wearable_volume,ROUND(erc721.amount * ghst.usd) + ROUND(erc1155.amount * ghst.usd) as total_amount,erc721.items + erc1155.items as total_volume,ghst.month as month,ghst.year as year,CONCAT(CAST(ghst.month as varchar), '/', CAST(ghst.year as varchar)) as month_yearFROM erc721LEFT JOIN erc1155 ON erc721.month = erc1155.month AND erc721.year = erc1155.yearLEFT JOIN ghst ON ghst.month = erc1155.month AND ghst.year = erc1155.year