La version tableau croisé simple d'un pivot()
ressemblerait à ceci :
select
dfips
, dcounty
, mail_sumton = sum(case when context = 'mail' then sumton else null end)
, rail_sumton = sum(case when context = 'rail' then sumton else null end)
from t
group by dfips, dcounty