Query editor
WITH Top100Holders AS (SELECT"to" AS holder_address,SUM(value) AS current_totalFROM erc20_ethereum.evt_TransferWHEREcontract_address = 0x514910771AF9Ca656af840dff83E8264EcF986CAGROUP BY"to"ORDER BYcurrent_total DESCLIMIT 100),CurrentHoldings AS (SELECT"to" AS holder_address,SUM(value) AS current_totalFROM erc20_ethereum.evt_TransferWHEREcontract_address = 0x514910771AF9Ca656af840dff83E8264EcF986CAAND evt_block_time >= current_date - interval '7' dayGROUP BY"to"),Holdings7DaysAgo AS (SELECT"to" AS holder_address,SUM(value) AS total_7_days_agoFROM erc20_ethereum.evt_TransferWHEREcontract_address = 0x514910771AF9Ca656af840dff83E8264EcF986CAAND evt_block_time BETWEEN (current_date - interval '14' day) AND (current_date - interval '7' day)GROUP BY"to")SELECTt.holder_address,ROUND(COALESCE(c.current_total, CAST(0 AS uint256)) / 1e18, 2) AS current_total_readable,COALESCE(h.total_7_days_ago, CAST(0 AS uint256)) AS total_7_days_ago,((COALESCE(c.current_total, CAST(0 AS uint256)) - COALESCE(h.total_7_days_ago, CAST(0 AS uint256))) / COALESCE(h.total_7_days_ago, CAST(1 AS uint256))) * 100 AS percentage_changeFROM Top100Holders tLEFT JOIN CurrentHoldings c ON t.holder_address = c.holder_addressLEFT JOIN Holdings7DaysAgo h ON t.holder_address = h.holder_addressGROUP BY t.holder_address, c.current_total, h.total_7_days_agoHAVING COALESCE(c.current_total, CAST(0 AS uint256)) >= COALESCE(h.total_7_days_ago, CAST(0 AS uint256))ORDER BYpercentage_change DESC;