我正在运行此查询:
SELECT title1,
[precinct percent] AS [PrecinctPercent],
leader,
[leader percent] AS [LeaderPercent],
Winner,
WinningVotes,
leader2,
[leader2 percent] AS [Leader2Percent],
Loser,
LosingVotes
FROM dbo.[RACE] r inner join
(select rc.[race number],
max(case when seqnum = 1 then [candidate num] end) as Winner,
max(case when seqnum = 1 then Votes end) as WinningVotes,
max(case when seqnum = 2 then [candidate num] end) as Loser,
max(case when seqnum = 2 then Votes end) as LosingVotes
from (select rc.*,
row_number() over (partition by rc.[race number] order by votes desc) as seqnum
from dbo.[RACE CANDIDATES] rc
) rc
group by rc.[race number]
) rc
on r.[race number] = rc.[race number]
FOR XML PATH
问题,是否可以命名XML文件并指定将其导出到的目录?我在使文件名保持一致并将文件放在目录中时遇到了一些麻烦。对不起,查询格式看起来不像我写的那样。
谢谢你的期待。