我有一个看起来像这样的表:
+---------+------------+----------+
| User_id | start_date | end_date |
+---------+------------+----------+
| 123 | 1/1/2015 | 3/1/2015 |
| 234 | 1/1/2015 | 1/1/2015 |
| 345 | 2/1/2015 | 3/1/2015 |
| 456 | 3/1/2015 | 3/1/2015 |
| : | | |
| : | | |
+---------+------------+----------+
输出应该是:
Months_since_live
+-------------+---+---+---+---+
| | 0 | 1 | 2 | 3 |
+-------------+---+---+---+---+
| Jan_signups | 2 | 1 | 1 | 0 |
| Feb_signups | 1 | 1 | 0 | |
| Mar_signups | 1 | 0 | | |
| : | | | | |
| : | | | | |
+-------------+---+---+---+---+