История изменений
Исправление Psilocybe, (текущая версия) :
select t.company_id,c.name,t.turnover
from (
select
company_id,
turnover,
row_number() over (partition by company_id order by year desc, quarter desc) rn
from company_turnover t
) t
join company c on c.id=c.company_id
where rn=1
Исправление Psilocybe, :
select t.company_id,c.name,t.turnover
from (
select
company_id,
turnove,
row_number() over (partition by company_id order by year desc, quarter desc) rn
from company_turnover t
) t
join company c on c.id=c.company_id
where rn=1
Исходная версия Psilocybe, :
select t.company_id,c.name,t.turnover
from (
select
company_id, year, quarter, turnover,
row_number() over (partition by company_id order by year desc, quarter desc) rn
from company_turnover t
) t
join company c on c.id=c.company_id
where rn=1