Query editor
withcontent_coin as (SELECT * FROM query_6226235),creator_coin as (SELECT * FROM query_6226438),zora_hook_trades AS (SELECTcontract_address AS hook_address, evt_tx_hash, evt_index, evt_block_time, evt_tx_from, evt_tx_to, PoolKeyHash, hookData, sender, swapSender, isTrustedSwapSenderAddress, isCoinBuy, amount0, amount1, key, params, JSON_QUERY(params, 'strict $.zeroForOne') as zero_for_one-- , CASE WHEN JSON_QUERY(params, 'strict $.zeroForOne') = 'true' THEN amount1-- WHEN JSON_QUERY(params, 'strict $.zeroForOne') = 'false' THEN amount0-- ELSE NULL-- END AS coin_amount-- , CASE WHEN JSON_QUERY(params, 'strict $.zeroForOne') = 'true' THEN amount0-- WHEN JSON_QUERY(params, 'strict $.zeroForOne') = 'false' THEN amount1-- ELSE NULL-- END AS currency_amount-- , CASE WHEN JSON_VALUE(params, 'strict $.zeroForOne') = 'true' THEN JSON_VALUE(key, 'strict $.currency1')-- WHEN JSON_VALUE(params, 'strict $.zeroForOne') = 'false' THEN JSON_VALUE(key, 'strict $.currency0')-- ELSE NULL-- END AS coin_address-- , CASE WHEN JSON_VALUE(params, 'strict $.zeroForOne') = 'true' THEN JSON_VALUE(key, 'strict $.currency0')-- WHEN JSON_VALUE(params, 'strict $.zeroForOne') = 'false' THEN JSON_VALUE(key, 'strict $.currency1')-- ELSE NULL-- END AS currency_address, CASE WHEN isCoinBuy = true and amount0 > 0 then amount0WHEN isCoinBuy = true and amount1 > 0 then amount1WHEN isCoinBuy = false and amount0 < 0 then amount0WHEN isCoinBuy = false and amount1 < 0 then amount1END AS coin_amount, CASE WHEN isCoinBuy = true and amount0 > 0 then amount1WHEN isCoinBuy = true and amount1 > 0 then amount0WHEN isCoinBuy = false and amount0 < 0 then amount1WHEN isCoinBuy = false and amount1 < 0 then amount0END AS currency_amount, CASE WHEN isCoinBuy = true and amount0 > 0 then JSON_VALUE(key, 'strict $.currency0')WHEN isCoinBuy = true and amount1 > 0 then JSON_VALUE(key, 'strict $.currency1')WHEN isCoinBuy = false and amount0 < 0 then JSON_VALUE(key, 'strict $.currency0')WHEN isCoinBuy = false and amount1 < 0 then JSON_VALUE(key, 'strict $.currency1')END AS coin_address, CASE WHEN isCoinBuy = true and amount0 > 0 then JSON_VALUE(key, 'strict $.currency1')