Created
April 29, 2015 18:56
-
-
Save ryancole/53449a13e3c38b763319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RankedMonthlySizes AS | |
( | |
SELECT Matter_MatterId AS MatterId, | |
HostingFilesize, | |
DENSE_RANK() OVER (PARTITION BY Matter_MatterId ORDER BY MonthAndYear DESC) AS DateRank | |
FROM dbo.RelativityMatterFilesizes | |
) | |
SELECT s.MatterId, s.HostingFilesize | |
FROM RankedMonthlySizes AS s | |
JOIN dbo.Matters AS m ON m.MatterId = s.MatterId | |
WHERE s.DateRank = 1 AND (m.InRelativity = 1 AND (m.IsHibernated != 1 AND m.IsHidden != 1) AND m.RelativityArtifactId IS NOT NULL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment