1
如何通過問題解決組。通過iSNULL功能發佈組
SELECT
Tcg.ProviderID,
ISNULL(DATEDIFF(DAY , AEenc.StartDateTime , AEenc.EndDateTime),0) + ISNULL(DATEDIFF(DAY , IPenc.AdmissionDate , IPenc.ENDDate),0) as 'IPBedDays'
FROM #TargetClientGroup Tcg
INNER JOIN AEncounterDetail as AEenc
ON AEenc.ProviderID = Tcg.ProviderID
INNER JOIN [PEncounterDetail] as IPenc
ON IPenc.ProviderID = Tcg.ProviderID
--WHERE AEenc.StartDateTime >= @ReportDate
GROUP BY Tcg.ProviderID
我收到一個錯誤,因爲它不包含在聚合函數或GROUP BY子句中。
這看起來像一個很好的解決辦法。它對解決方案的工作很好。感謝您的幫助。 – user2637506