Versi tab silang sederhana dari pivot()
akan terlihat seperti ini:
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