This file contains hidden or 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 dates_table AS ( | |
| SELECT created::date AS date_column FROM sharer_emailshare WHERE showroom_id=5 | |
| ) | |
| SELECT series_table.date, COUNT(dates_table.date_column), SUM(COUNT(dates_table.date_column)) OVER (ORDER BY series_table.date) FROM ( | |
| SELECT (last_date - b.offs) AS date | |
| FROM ( | |
| SELECT GENERATE_SERIES(0, last_date - first_date, 1) AS offs, last_date from ( | |
| SELECT MAX(date_column) AS last_date, (MAX(date_column) - '1 year'::interval)::date AS first_date FROM dates_table | |
| ) AS a | |
| ) AS b |
NewerOlder