title: How to Group result from mySQL
body: <p>My Table:</p>
  
  <pre><code>datetime.                employment.        name
  2019-11-25 12:32:12.     office.            Michael Jackson
  2020-01-31 12:32:22.     production.        Jenny Darling
  2019-12-25 12:32:12.     office.            Michael Jackson
  etc.
  </code></pre>
  
  <p>This is a "time registering" table, so names must be DISTINCT for each mounth. (How many unique names is there every month grouped by month and employment)</p>
  
  <p>Now i'd like to create a table that will show how many employees there was in every month by year.<br>
  So the table will look like:</p>
  
  <pre><code>Year &amp; Month.    Employment.   Number (Unique names)
  -------------------------------------
  2019-01.         Office.       50
  2019-01          Production.   35
  2019-02.         Office.       45
  2019-02.         Production.   36
  </code></pre>
  
  <p>And so on for this and prev year (2019 &amp; 2020)</p>
  
  <p>Something like:</p>
  
  <pre><code>SELECT * FROM table COUNT(DISTINCT(name)) AS number GROUP BY datetime AND employment
  </code></pre>