with tab1 as (
SELECT
tx_from,
min(BLOCK_TIMESTAMP) as min_time
FROM osmosis.core.fact_transactions
GROUP by 1
)
SELECT
date_trunc('week', min_time) as week,
POOL_ID[0] as pool,
count(*)
FROM osmosis.core.fact_liquidity_provider_actions
LEFT OUTER JOIN tab1
ON LIQUIDITY_PROVIDER_ADDRESS = tx_from
AND min_time = BLOCK_TIMESTAMP
WHERE NOT tx_from is NULL
GROUP BY 1,2