pivot()
. का सरल क्रॉसस्टैब संस्करण इस तरह दिखेगा:
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