-- redelegate, undelegate, delegate
SELECT
block_timestamp::date AS "Date",
COUNT(DISTINCT delegator_address) AS "Number of unstakers",
COUNT(DISTINCT validator_address) AS "Number of validators",
sum(amount / pow(10, decimal)) AS "Unstaked Amount"
FROM osmosis.core.fact_staking
WHERE action='undelegate'
AND tx_status='SUCCEEDED'
GROUP BY "Date"