title: Maximum number of Licences Issued in year 2017 to different categories
body: <p>I want to find the Maximum number of Licences Issued in the year 2017 for different categories. Please help</p>
  <pre><code>SELECT
      YEAR(BL.[Issued]) as YearIssuesd,
      BL.[Category] as Category, 
      COUNT(*) as TotalLicenceIssued 
  from
      [dbo].[businesslicences$] BL 
  GROUP BY
      YEAR(BL.[Issued]),
      (BL.[Category])
  HAVING
      COUNT(*) = (
          SELECT
              MAX(MC)
          FROM
          (
              SELECT
                  COUNT( BL.[Licence No#] ) AS MC
              from
                  [dbo].[businesslicences$] BL
              GROUP BY BL.[Category]
          )
  </code></pre>