Unexpected result when joining a table in a year range
Let me suggest another approach by adding a Years table. 




create table p (id int, criterium decimal(18,2), init_year int, end_year int);

create table years(cyear int);

insert into years values(2010),(2011),(2012),(2013),(2014),(2015),(2016),(2017),(2018),(2019),(2020);

insert into p values (1, 93.0, 2018, 2020), (2, 50.0, 2015, 2017), (3, 74.5, 2010, 2012);



Now you can expand dates between initial and ending date, then simply sum year values that match user dates.




select id,
       cyear,
       (criterium / ((end_year - init_year) + 1.0)) as va
from   p
join   years
on     cyear &gt;= init_year
and    cyear &lt;= end_year
order by id;



id | cyear |        va
-: | ----: | --------:
 1 |  2018 | 31.000000
 1 |  2019 | 31.000000
 1 |  2020 | 31.000000
 2 |  2017 | 16.666667
 2 |  2015 | 16.666667
 2 |  2016 | 16.666667
 3 |  2010 | 24.833333
 3 |  2011 | 24.833333
 3 |  2012 | 24.833333



db&lt;>fiddle here




select sum((criterium / ((end_year - init_year) + 1.0))) as total
from   p
join   years
on     cyear &gt;= init_year
and    cyear &lt;= end_year
where  cyear &gt;= 2016 and cyear &lt;= 2018;



|     total |
| --------: |
| 64.333333 |



db&lt;>fiddle here