Query editor
with free_claims as (select address, free_mints from query_4091459),fullset_holders_hj5_snapshot as (select address,casewhen address=0x20134bf3fB2c960BBf6195ab43D87EFb7dC042bE then full_sets+1 --edge case, user had 4 sets across 2 wallets for hj5, combined into 1 wallet for hj6, so 'lost' gtd spot on other walletelse full_setsend as full_setsfrom query_4520846UNIONselect 0x70a9c497536e98f2dbb7c66911700fe2b2550900 as address, 1 as full_sets),fullset_holders_hj6_snapshot as (select address, full_sets from query_4491253where full_sets>0UNIONselect 0xb207d34a81941bfa3C37Fb865D4457988cCb27FA, 1 as full_sets --edge case, user started collecting assets before the snapshot and completed just few minutes after deadline)select coalesce(m.address,f.address) as address, coalesce(hj5_sets,0) as hj5_sets, coalesce(hj6_sets,0) as hj6_sets,coalesce(free_mints,0) as gate1_free_mints,casewhen hj5_sets > hj6_sets then hj6_setswhen hj5_sets < hj6_sets then hj5_setswhen hj5_sets = hj6_sets then hj5_setswhen coalesce(hj6_sets,0) = 0 then 0end as gate1_paid_mints,casewhen hj5_sets > hj6_sets then 0when hj5_sets < hj6_sets then (hj6_sets-hj5_sets)when hj5_sets = hj6_sets then 0when coalesce(hj6_sets,0)=0 then 0end as gate2_paid_mintsfrom (select coalesce(hj5.address,hj6.address) as address, coalesce(hj5.full_sets,0) as hj5_sets, coalesce(hj6.full_sets,0) as hj6_sets from fullset_holders_hj5_snapshot hj5full join fullset_holders_hj6_snapshot hj6 on hj5.address=hj6.addresswhere hj6.full_sets>0) mfull join free_claims f on f.address=m.addressorder by hj5_sets desc