title: SQL 'SELECT' Statement with Calculated Column
body: <p>I'm developing an IT Support Management database. The following SQL query involves two tables. The 'devices' table contains all the PCs owned by a company, and the 'services' table is a list of every service performed on devices (ie. each device can have multiple services). </p>
  
  <p>I want this query to retrieve the <code>entire 'devices' table</code>, but include an extra column that shows the <code>total</code> number of <code>services</code> for each <code>device</code>.</p>
  
  <p>The following statement I've come up with is probably far from correct. For every row, it returns a count of the total number of records in the <code>'services'</code> table (ie. same number on each row) rather than grouping/filtering to each device.</p>
  
  <pre><code>SELECT *,
         (SELECT Count(services.id)
          FROM   dbo.services
                 LEFT JOIN devices
                        ON services.assetID = devices.assetID
          GROUP  BY devices.assetID) AS TotalServices
  FROM   dbo.devices 
  </code></pre>
  
  <p>What approach should I be using to achieve this? Thanks in advance for any guidance or assistance!</p>