我有两个选择查询需要合并....
SELECT [DatapointID]
,[AssetID]
,[DatapointID]
,[SourceTag]
,'-' + [TimeStep] + [TimeStepValue] AS TimeStep
,[DataRetrievalInterval] + [DataRetrievalIntervalValue] AS [RetInterval]
,NULL AS DatapointDate
,NULL AS DatapointValue
,0 As DataFlagID
,DateADD(-1, d @SearchDateEnd) + @SearchTimeEnd DateDataGrabbed
,GetDate() DateTimeAddedtoDB
FROM [dbo].[tblTSS_Assets_Datapoints]
Where AssetID = 204
Select DatapointDate, SUM(DataPointValue) as DataPointValue From @temp
GROUP BY DatapointDate
ORDER BY DatapointDate
第一个选择查询是我想要的最终结果,而不是 NULL 作为 DatapointDate 和 DatapointValue 我想要来自 @temp 的值
我怎样才能做到这一点?