Query editor
WITH claim_dates as (with claims_seq as (SELECTsequence(cast('2022-02-05 16:00' as timestamp),cast('2035-02-05 16:00' as timestamp),interval '1' month) as claim)SELECTclaims.claim_dateFROM claims_seqCROSS JOIN unnest(claim) as claims(claim_date) --this is just doing explode like in spark sql),last_vote as (SELECTclaim_date as timeFROM claim_datesWHERE claim_date < now()ORDER BY 1 DESCLIMIT 1),withdrawals as (SELECTevt_block_time,account,token,amount,value,'ethereum' as networkFROM airswap_ethereum.Pool_v4_1_evt_WithdrawUNION ALLSELECTevt_block_time,account,token,amount,value,'bsc' as networkFROM airswap_bnb.Pool_v4_1_evt_WithdrawUNION ALLSELECTevt_block_time,account,token,amount,value,'polygon' as networkFROM airswap_polygon.Pool_v4_1_evt_WithdrawORDER BY evt_block_time desc)