Postgresql: Using Rank function with a date interval
I have an existing query that uses the RANK() function to sum (or count) a column and rank results over a specified date range. Up until now, I have only needed the total aggregate sum or count of the given column over the date range. Now, however, I would like to create a window within this larger date range that allows me to rank results based on their count/sum over this smaller period within the overall date range. In plain english, this would be something like “find the most tracks within a consecutive 3 day period over a 30 day period”.