One approach is to do the aggregation before the join:
select det.*,
SUM(hst.Q_Access) as "Access"
from OtoHistorique hst inner Join
(select det.IdHistoric,
SUM(CASE WHEN det.IdGarantie != 18 AND det.IdGarantie != 17 AND det.IdGarantie!= 11 THEN det.Q_PrimeNette ELSE 0 END) as "cot nette"
SUM(CASE WHEN det.IdGarantie = 18 THEN det.Q_PrimeNette ELSE 0 END) AS "Fond comp",
SUM(CASE WHEN det.IdGarantie = 11 THEN det.Q_PrimeNette ELSE 0 END) AS "Carte Verte",
SUM(CASE WHEN det.IdGarantie = 17 THEN det.Q_PrimeNette ELSE 0 END) AS "Adhesion",
SUM(CASE WHEN det.IdGarantie != 18 AND det.IdGarantie != 17 AND det.IdGarantie!= 11 THEN det.Q_Taxe ELSE 0 END) AS "Taxe",
SUM(CASE WHEN det.IdGarantie = 18 THEN det.Q_Taxe ELSE 0 END) AS "Taxe Fond Comp",
SUM(CASE WHEN det.IdGarantie = 17 THEN det.Q_Taxe ELSE 0 END) AS "Taxe Adhésion",
SUM(CASE WHEN det.IdGarantie = 11 THEN det.Q_Taxe ELSE 0 END) AS "Taxe carte verte",
SUM(hst.Q_Access) as "Access"
from OtoHistoriqueDet det
group by det.IdHistorique
) det
On det.IdHistorique = hst.IdHistorique
where hst.POLICE = 3221086;
Because you are filtering the query, this might be expensive. The entire details table has to be aggregated. So, you can do the join in the subquery for filtering purposes and then again for the calculation:
select det.*,
SUM(hst.Q_Access) as "Access"
from OtoHistorique hst inner Join
(select det.IdHistoric,
SUM(CASE WHEN det.IdGarantie != 18 AND det.IdGarantie != 17 AND det.IdGarantie!= 11 THEN det.Q_PrimeNette ELSE 0 END) as "cot nette"
SUM(CASE WHEN det.IdGarantie = 18 THEN det.Q_PrimeNette ELSE 0 END) AS "Fond comp",
SUM(CASE WHEN det.IdGarantie = 11 THEN det.Q_PrimeNette ELSE 0 END) AS "Carte Verte",
SUM(CASE WHEN det.IdGarantie = 17 THEN det.Q_PrimeNette ELSE 0 END) AS "Adhesion",
SUM(CASE WHEN det.IdGarantie != 18 AND det.IdGarantie != 17 AND det.IdGarantie!= 11 THEN det.Q_Taxe ELSE 0 END) AS "Taxe",
SUM(CASE WHEN det.IdGarantie = 18 THEN det.Q_Taxe ELSE 0 END) AS "Taxe Fond Comp",
SUM(CASE WHEN det.IdGarantie = 17 THEN det.Q_Taxe ELSE 0 END) AS "Taxe Adhésion",
SUM(CASE WHEN det.IdGarantie = 11 THEN det.Q_Taxe ELSE 0 END) AS "Taxe carte verte"
from OtoHistoriqueDet det join
OtoHistorique hst
On det.IdHistorique = hst.IdHistorique and hst.POLICE = 3221086
group by det.IdHistorique
) det
On det.IdHistorique = hst.IdHistorique
where hst.POLICE = 3221086;