WITH query_table1 AS
(SELECT BLOCK_TIMESTAMP, TX_ID, TOKEN_ADDRESS, POOL_ADDRESS, POOL_NAME, (case when direction='OUT' then amount_out when direction='IN' then amount_in end) as amount
from ethereum.dex_swaps
where token_address='0xf76d80200226ac250665139b9e435617e4ba55f9'
and pool_address = '0x66bd3cc6e52cb76696144df432393258f2cb2d66'
order by amount DESC)
SELECT * FROM query_table1