title: Finding the total number of records per customer in SQL Server 2008
body: <p>I have a table that links my customers to DVDs they have checked out. My table is called CustomerDvds. That table looks like this:</p>
  
  <pre><code>CustomerDvds
  - ID
  - CustomerID
  - DvdID
  - CheckOutDate
  - CheckInDate
  </code></pre>
  
  <p>I am trying to write a query that will tell me how many DVDs each customer has checked out on a specific date. Currently, I have written the following: </p>
  
  <pre><code>SELECT
    CustomerID,
    SUM(DvdID) as 'DVDCount'
  FROM
    CustomerDvds
  WHERE
    [CheckOutDate]&lt;=GetUtcDate() AND
    [CheckInDate]&gt;GetUtcDate()
  GROUP BY
    [CustomerID]
  </code></pre>
  
  <p>Unfortunately, my DVDCount value seems way high. What am I doing wrong? How do I fix this query?</p>
  
  <p>Thanks</p>