Это то, что вы хотите?
select deviceModel, deviceType,
avg( case when eventType = 'received' then 1.0 else 0 end ) as received_ratio
from t
where eventType in ('received', 'success')
group by deviceModel, deviceType;
Или это логика?
select deviceModel, deviceType,
sum(case when eventType = 'received' then 1
when eventType = 'success' then -1
else 0
end ) / count(*) as received_ratio
from t
group by deviceModel, deviceType;
Ни один из них не учитывает "неудачу", но вы, кажется, проситеодин из них.
РЕДАКТИРОВАТЬ:
Если вы хотите соотношение отказов, это будет:
select deviceModel, deviceType,
avg( case when eventType = 'failure' then 1.0 else 0 end ) as failure_ratio
from t
group by deviceModel, deviceType;