title: MySQL group by multiple columns issue
body: <p>The query below collects temporary overview data for every user into memory table. Basicaly, user sees, count of items by keyword. </p>
  
  <p>The problem is, it calculates total count of items by <code>keyword_id</code>. </p>
  
  <p>What I need is, to calculate <code>item_count</code> by both <code>keyword_id</code> and <code>item_type</code> (<code>Item</code>.<code>type</code>).</p>
  
  <pre><code> SELECT
          `Item`.`user_id` AS `user_id` ,
          `ItemKeyword`.`keywordID` AS `keyword_id` ,
          `Keyword`.`title` AS `keyword_title`,
          count(`ItemKeyword`.`ItemID`) AS `ico_count`
      FROM
          (
              (
                  `ItemKeyword`
                  JOIN `Item` ON(
                      (
                          `Item`.`id` = `ItemKeyword`.`ItemID`
                      )
                  )
              )
              JOIN `Keyword` ON(
                  (
                      `Keyword`.`id` = `ItemKeyword`.`keywordID`
                  )
              )
          )
      GROUP BY
          `Item`.`user_id` ,
          `ItemKeyword`.`keywordID`;
  </code></pre>
  
  <h1>Details</h1>
  
  <p>For example, now result looks like below</p>
  
  <p><a href="https://i.stack.imgur.com/CpJJ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CpJJ3.png" alt="enter image description here"></a></p>
  
  <p>Basicaly, <code>item_count</code> is total of all <code>item_type</code>s. What I need is, to separate the result below </p>
  
  <pre><code>user_id   keyword_id  keyword_title   item_count
  1         9645         surveillance    20
  </code></pre>
  
  <p>Into something like this:</p>
  
  <pre><code>user_id   keyword_id  keyword_title   item_count item_type
  1         9645         surveillance    18           1
  1         9645         surveillance    2            2
  </code></pre>
  
  <p>Where, <code>item_count</code> are calculated by both <code>keyword_id</code> and <code>item_type</code>.</p>
  
  <p>I can't figure out how to include <code>item_type</code> also into this query.</p>
  
  <p>Any suggestions?</p>