0
我有以下查詢,我試圖返回兩個DateTime
列之間的平均值。兩個日期時間列之間的平均值
我的問題是它想讓我組SoftwarePackage1_VersionNumbers.EnvShortName
,我不想這樣做。類似於在此查詢的方法之一
SELECT DBO.softwarepackage1_versionnumbers.envshortname AS [Environment Name],
DBO.softwarepackage1_versionnumbers.currentversionnumber AS [SoftwarePackage1 Current Version Number],
DBO.softwarepackage1_versionnumbers.currentbuildname AS [Current SoftwarePackage1 Build],
DBO.softwarepackage1_versionnumbers.currentlastassociatedchangeset AS [Last Associated Changeset],
DBO.softwarepackage1_versionnumbers.deploymentdate AS [SoftwarePackage1 Deployment Date],
DBO.softwarepackage2_versionnumbers.currentsoftwarepackage2displayedversionnumber AS [SoftwarePackage2ector Displayed Version Number],
DBO.softwarepackage2_versionnumbers.currentsoftwarepackage2fullversionnumber AS [SoftwarePackage2ector Full Version Number],
DBO.softwarepackage2_versionnumbers.currentlastfilewritedatetime AS [SoftwarePackage2ector Last File Write Time],
DBO.softwarepackage2_versionnumbers.deploymentdate AS [SoftwarePackage2ector Deployment Date],
Avg(Datediff(MINUTE, DBO.softwarepackage1_versionnumbers.modifieddatetime, DBO.softwarepackage2_versionnumbers.modifieddatetime)) AS [Last Version Check (UTC)]
FROM DBO.softwarepackage1_versionnumbers
FULL OUTER JOIN DBO.softwarepackage2_versionnumbers
ON DBO.softwarepackage1_versionnumbers.envid = DBO.softwarepackage2_versionnumbers.envid
FULL OUTER JOIN DBO.systemenvironments
ON DBO.softwarepackage1_versionnumbers.envid = DBO.systemenvironments.envid
WHERE (DBO.softwarepackage1_versionnumbers.deleted = '0')
AND (DBO.softwarepackage2_versionnumbers.deleted = 0)
AND (DBO.systemenvironments.envtype = 'Development')
平均在什麼範圍?在結果集中的所有行上?在特定的子範圍內? –
這將是該行的平均水平 –
您是否嘗試過我的答案?它有用嗎? –