转置SQL结果

时间:2017-12-22 14:25:52

标签: sql-server tsql

我有以下sql查询

SELECT  [POINT],[Timestamp],AvgValue=AVG(ValueNumeric)
FROM [myDatabase].[dbo].[Value] 
WHERE [Point] In (98,99,100,101,102,103,104,105) 
  AND Timestamp between DATEADD(DAY, -90, GETDATE()) and GETDATE() 
Group by [timestamp],[Point] 
order by [Timestamp], [Point]

返回表格如下

但我需要将其转置如下

Timestamp|Point1|Value1|Point2|Value2|Point3|Value3|

这可行吗?

0 个答案:

没有答案