select
name,
provider,
max(price) as last_max_price -- дело в том, что в последнюю дату для данных name и provider могут быть записи с разными price
from
(select
name,
provider,
price,
rank() over(partition by name, provider order by date desc) as rk
from purchase) as t
where rk = 1
group by name, provider