title: Count Query in SQL
body: <p>I am using SQL 2005.</p>
  
  <p>Table one, LinkedDocumentFolderTable, contains the names and information about the folders that hold linked documents.</p>
  
  <p>Table two, LinkedDocumentTable, contains the information about the linked documents themselves.</p>
  
  <p>The two tables are linked by the LinkedDocumentFolderID.</p>
  
  <p>I need the LinkedDocumentFolderID, Description, FolderURL and IsUnmanagedFolder from the LinkedDocumentFolderTable. I would also like to get a count of the number of linked documents in each folder (identified by the linkeddocumentfolderid).</p>
  
  <p>The statement below works from the perspective of giving me an overall count of documents in the LinkedDocumentTable, but doesn't break it out by linkeddocumentfolderid. Please help me re-write the statement to get a count of the linkeddocuments in each folder.  Thanks in advance.</p>
  
  <pre><code>select Count(*)
  from linkeddocumenttable
      select ld.linkeddocumentfolderid,ld.description,
      ld.folderURL,ld.isunmanagedfolder
      from linkeddocumentfoldertable ld
          inner join linkeddocumenttable l on
          ld.linkeddocumentfolderid=l.linkeddocumentfolderid      
  </code></pre>