select
'Pool Id:' || b.value::string as "Pool ID",
count(DISTINCT TX_ID) as tx_count,
sum(FROM_AMOUNT/pow(10,FROM_DECIMAL)) as amount_from,
sum(TO_AMOUNT/pow(10,TO_DECIMAL)) as amount_to
from osmosis.core.fact_swaps, lateral flatten(input => pool_ids) b
where block_timestamp::date>='2022-05-01'
and TX_STATUS='SUCCEEDED'
group by 1