title: How to get differents values 'types' from table creating virtual columns - MySQL
body: <p>I have these tables.</p>
  
  <p><strong>tb_employee</strong>:</p>
  
  <pre><code>ID_EMP           NAME_EMP
  1               Employee 1
  2               Employee 2
  3               Employee 3
  4               Employee 4
  </code></pre>
  
  <p><strong>tb_requirements</strong>:</p>
  
  <pre><code>ID_REQ                  DESCRIPTION_REQ               TYPE_REQ
  1                        Requirement 1                   1
  2                        Requirement 2                   1
  3                        Requirement 3                   1
  4                        Requirement 4                   2
  5                        Requirement 5                   2
  6                        Requirement 6                   2
  7                        Requirement 7                   2
  </code></pre>
  
  <p><strong>tb_detail</strong>:</p>
  
  <pre><code>ID_DET                        ID_EMP                        ID_REQ
  1                               1                             1
  2                               1                             2
  3                               1                             4
  4                               2                             1
  5                               2                             6
  6                               3                             4
  7                               3                             7
  </code></pre>
  
  <p>I need to make a <code>SELECT QUERY</code> to count how many <code>requirements</code> each employee has got and which type, like this:</p>
  
  <pre><code>ID_EMP               NAME_EMP          TYPE_REQ1(virtual column)     TYPE_REQ2 (virt. c.)
  1                    Employee 1               2                         4
  2                    Employee 2               1                         1
  3                    Employee 3               0                         2
  4                    Employee 4               0                         0
  </code></pre>
  
  <p>I really don't know how to do it.</p>