Query editor
WITH nested AS (SELECT bytearray_to_uint256(topic2) as collection,bytearray_to_uint256(bytearray_substring(data, 1, 32)) as tokenIdFROM ethereum.logsWHERE contract_address = 0x49960769aa50b533aa628acdaa054bd5263d0d42AND topic0 = 0x1178cde67db78bc437458c38ef65b12c375c4099998599e5b096f1cea5a0bb00),released AS (SELECT bytearray_to_uint256(topic2) as collection,bytearray_to_uint256(bytearray_substring(data, 1, 32)) as tokenIdFROM ethereum.logsWHERE contract_address = 0x49960769aa50b533aa628acdaa054bd5263d0d42AND topic0 = 0xa5955cb007b105cd3ff3bf43a1ec37247fe7c45ba2ba85489a20d7f7e5dac551)SELECTCASE n.collection WHEN 0 THEN 'Moonbirds' WHEN 1 THEN 'Mythics' WHEN 2 THEN 'Oddities' END as collection,COUNT(*) as activeFROM nested nLEFT JOIN released r ON n.collection = r.collection AND n.tokenId = r.tokenIdWHERE r.tokenId IS NULLGROUP BY 1