select case when hook_type = 0 then 'offer'
when hook_type = 1 then 'accept'
else 'expired'
end as hook_t,
`hook name` as hook_name,
count(*) as number_of_exchange_activities
from `exchange`
group by hook_t
BTW I think you want to escape the column name hook name
. Then use backticks and not quotes.