这是表结构:
Election
ElectionId ElectionName
1 12P
2 11G
History
ElectionId VoterId HowVoted
1 1 Rep
2 2 Dem
1 2 Non
Voter
VoterId VoterName
1 Bill Smith
2 John Hearst
我想要这样的输出:
VoterName 12P 11P note: Election names change so need to be pivoted dynamically
Bill Smith Rep Null
John Hearst Non Dem
我基本上需要将 ElectionNames 转为 Column Names,然后显示选民如何在行中投票。建议?谢谢!