Count (Distinct ([value)) OVER (Partition by) in SQL Server 2008
问题 I have written this and successfully executed in Oracle COUNT (DISTINCT APEC.COURSE_CODE) OVER ( PARTITION BY s.REGISTRATION_NUMBER ,APEC.APE_ID ,COV.ACADEMIC_SESSION ) APE_COURSES_PER_ACADEMIC_YEAR I'm trying to achieve the same result in SQL Server (our source database uses Oracle but our warehouse uses SQL Server). I know the distinct isn't supported with window functions in SQL Server 2008 - can anyone suggest an alternative? 回答1: Here's what I recently came across. I got it from this