I have the following table:
user_id document_id date
------------------------------------
1 1 2016-01-01
1 2 2016-01-01
1 3 2016-01-02
2 4 2016-01-01
2 5 2016-01-02
3 6 2016-01-02
3 7 2016-01-02
3 8 2016-01-02
3 9 2016-01-03
3 10 2016-01-03
3 11 2016-01-04
3 9 2016-01-04
Is it possible to - in SQL - get the number of documents viewed, per user per day, in tabular format?
date user_id_1 user_id_2 user_3
----------------------------------------------
2016-01-01 2 1 0
2016-01-02 1 1 3
2016-01-03 0 0 2
2016-01-04 0 0 2
Normally I would use any scripting language to create this by looping through a resultset, but in this particular case I can't. Because of restrictions, I only have access to SQL server.
If this is even possible, any help is greatly appreciated.