I have the below table:
+-----------+------+-------+
| member_id | year | count |
+-----------+------+-------+
| 1 | 2012 | 1 |
| 1 | 2013 | 0 |
| 1 | 2014 | 1 |
| 2 | 2012 | 2 |
| 2 | 2013 | 0 |
| 2 | 2014 | 1 |
+-----------+------+-------+
and i'd like to turn it into this:
+-----------+------------+------------+------------+
| member_id | count_2012 | count_2013 | count_2014 |
+-----------+------------+------------+------------+
| 1 | 1 | 0 | 1 |
| 2 | 2 | 0 | 1 |
+-----------+------------+------------+------------+
I tried grouping and then pivoting and also just pivoting, but the pivot requires and aggfunc, and I'm not trying to change the values, just reshape it.