Requête |
with T1 as (
(select distinct pays as ABSCISSE,'nb hommes pêche' as GROUPE,sum(nb_homme_peche*txa) as TOTAL
from
total.liste_site inner join total.calcul_txa using(pays,strate)
inner join total.v_liste_menage using (pays,no_site)
group by ABSCISSE order by ABSCISSE )
union
(select distinct pays as ABSCISSE,'nb hommes transfo' as GROUPE,sum(nb_homme_transfo*txa) as TOTAL
from
total.liste_site inner join total.calcul_txa using(pays,strate)
inner join total.v_liste_menage using (pays,no_site)
group by ABSCISSE order by ABSCISSE )
union
(select distinct pays as ABSCISSE,'nb hommes commerce' as GROUPE,sum(nb_homme_commer*txa) as TOTAL
from
total.liste_site inner join total.calcul_txa using(pays,strate)
inner join total.v_liste_menage using (pays,no_site)
group by ABSCISSE order by ABSCISSE ))
select * from T1 where total>0 order by abSCISSE,GROUPE
|