Give a simple table like this:
ClientCode | Date | Amount
--------------------------------
1 | 2014-01-01 | 10
1 | 2014-01-01 | 20
2 | 2014-01-01 | 30
1 | 2014-01-02 | 15
I need a query that would list the count of rows for every client for every day like this:
ClientCode | day2014-01-01 | day2014-01-02 | day2014-01-03
1 | 2 | 1 | 0
2 | 1 | 0 | 0
I could make a CASE for every day but I need it for 120 days and about 80000 clients.
Any advice?