我正在尝试在Excel中运行以下查询,它会给我一条消息:'无法添加表'(......'
这在SSMS中运行良好。我不是Excel专业人士。我认为这是对子查询的影响 任何建议/语法更正,使其在Excel中工作?
由于
SELECT Pvt.GNumber, [4093], [4096], [4099], [4102]
FROM
(
SELECT GNumber
, Convert(Integer, EndDate)+2 AS EndDate
, EndBal
FROM [Server].[Dbname].[dbo].[tblnumber]
WHERE Number='00S'
AND EndDate>=CONVERT(DateTime, '2012-01-31')
AND EndDate<=CONVERT(DateTime, '2013-12-31')
) Results
Pivot (
SUM(EndBalance)
FOR EndDate IN ([4093], [4096], [4099], [4102])
) AS Pvt
ORDER BY Pvt.GLNumber