Generating series of data in PostgreSQL

Recently I had received an apparently simple task: "Count the number of returning users, per month age.", and it should be presented like a cohort analysis. It should be solved as a simple query and returning something like this: year_month_first_buy | month_age | count ----------------------+-----------+------- 200904 | 0 | 10 200904 | 1 | 8 200904 |…

Advertisements