title: COUNT total by weekly and monthly SQL
body: <p>I have a table in which I have to count total rows assigned to each USER by daily, weekly and monthly.</p>
  
  <p>Table BooksIssued</p>
  
  <pre><code>BOOKID    ISSUEDUSER    DATE
   1            A        20160708
   2            A        20160709
   3            A        20160708
   4            A        20150102
   5            B        20160709
   6            C        20160708
   7            C        20160708
  </code></pre>
  
  <p>Now I have to COUNT daily, weekly and monthly books issued to each user</p>
  
  <p>Daily is today (20160709)
  Weekly is Sunday through Saturday
  Monthly is whole month</p>
  
  <p>The result should be</p>
  
  <pre><code>ISSUEDUSER    DAILYBOOKS WEEKLYBOOKS  MONTHLYBOOKS
    A               1       3           3
    B               1       1           1
    C               0       2           2
  </code></pre>
  
  <p>I have done this SQL for daily issued</p>
  
  <pre><code>SELECT ISSUEDUSER, COUNT(BOOKID) AS DAILYBOOKS
  FROM BOOKSISSUED
  WHERE DATE = CONVERT(VARCHAR(11), SYSDATETIME(), 112)
  GROUP BY ISSUEDUSER
  </code></pre>
  
  <p>Can someone please help me write a <strong>combined</strong> SQL for all three ?</p>
  
  <p>Thanks</p>
  
  <p>Aiden</p>