我收到以下错误
消息 156,级别 15,状态 1,第 10 行 关键字“SELECT”附近的语法不正确。消息 102,级别 15,状态 1,第 10 行 ')' 附近的语法不正确。
当我运行以下查询时
SELECT TOP 100 *
FROM
(
SELECT [TimeStamp],[MeterID],[Value]
FROM access_AMIData) AS source
PIVOT
(
SUM(Value)
FOR MeterID IN (SELECT MeterNumber FROM access_tblFcppPvMeterList)
) as pvt
ORDER BY TimeStamp
此行附带错误:
FOR MeterID IN (SELECT MeterNumber FROM access_tblFcppPvMeterList)
如果我将此行更改为:
FOR MeterID IN (1,2,3,4)
它工作得很好......我如何在 IN 中指定一个选择查询?