Is this what you're looking for?
SELECT t2.[index], t1.[type], t1.code, AVG([current]) avg_current, AVG([bpo]) avg_bpo, AVG([forecast]) avg_forecast
FROM table1 t1
INNER JOIN table2 t2 ON t2.code = t1.code
GROUP BY t2.[index], t1.[type], t1.code
ORDER BY t2.[index], t1.[type], t1.code;