Query editor
WITH usdtbets AS (SELECTPrematchCore_evt_NewBet.*,PrematchCore_evt_NewBet.evt_block_time AS bet_time,margin / 1e12 as coef_marginFROMazuro_polygon.PrematchCore_evt_NewBetLEFT JOIN azuro_polygon.PrematchCore_evt_NewBetMargin ON PrematchCore_evt_NewBet.evt_tx_hash = PrematchCore_evt_NewBetMargin.evt_tx_hashAND PrematchCore_evt_NewBet.tokenId = PrematchCore_evt_NewBetMargin.betId),usdtbetsfbs AS (SELECTusdtbets.*,CASEWHEN fbs.azuroBetId IS NULL THEN falseELSE trueEND AS is_freebetFROMusdtbetsLEFT JOIN query_3565136 AS fbs ON usdtbets.evt_tx_hash = fbs.evt_tx_hash),conditions AS (SELECTPrematchCore_evt_ConditionResolved.*,PrematchCore_evt_ConditionResolved.evt_block_time AS cond_time,(CASEWHEN CAST(state AS DOUBLE) = 1 THEN 'resolved'WHEN CAST(state AS DOUBLE) = 2 THEN 'cancelled'END) AS statusFROMazuro_polygon.PrematchCore_evt_ConditionResolved),PendingSingleBetsOnPlygonUsdtOfRidotto AS (SELECTusdtbetsfbs.bettor,cast(usdtbetsfbs.amount as double) / 1e6 as amount,usdtbetsfbs.bet_timeFROMusdtbetsfbsLEFT JOIN conditions ON usdtbetsfbs.conditionId = conditions.conditionIdWHEREusdtbetsfbs.affiliate = 0x1D4bcFfcEDE6004241a8827D5C2457c01d5c9112AND conditions.state IS NULL),CombinedBets AS (SELECTbettor,amount,DATE(bet_time) AS bet_dateFROM(SELECTbettor,amount,bet_timeFROMquery_2832316 -- all resolved betsWHEREaffiliate = 0x1D4bcFfcEDE6004241a8827D5C2457c01d5c9112