select sum(amount) , block_timestamp::date , CASE
when action in ('Redelegate' , 'Delegate') then 'stake'
when action='Undelegate' then 'unstake' end as staking_1
from terra.core.ez_staking where year(block_timestamp)=2023 and block_timestamp::date >='2023-01-07'
and block_timestamp::date <='2023-01-14'
group by 2,3