SQL Server, SSRS and Crystal Reports
Thursday, 24 May 2018
Count Distinct Over Partition
To get a count of distinct values over a windowing partition:
DENSE_RANK() OVER (PARTITION BY e.Dept_Desc order by e.Staff_No)
+ DENSE_RANK() OVER (PARTITION BY e.Dept_Desc order by e.Staff_No desc)
- 1
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)