title: SUM,COUNT with UNION in MySql
body: <p>I have a table that has the following schema:</p>
  
  <pre><code>DATA | CAUSE_1 | TIME_1 | CAUSE_2 | TIME_2 | CAUSE_3 | TIME_3
  </code></pre>
  
  <p>The <code>CAUSE.*</code> field (<code>VarChar</code>) can not contain any string, and if so, the field <code>TIME.*</code> is 0.</p>
  
  <p>I'm trying to create a query, but unfortunately without success, where I would have the result display in this form:</p>
  
  <pre><code>CAUSE | TOT_TIME | N_RIPET_CAUSE,
  </code></pre>
  
  <p>where:</p>
  
  <ul>
  <li>In <code>CAUSE</code> I have a list of what is contained in <code>CAUSE_1 ... CAUSE_3</code>,</li>
  <li>In <code>TOT_TIME</code> the sum of the values in <code>TIME_1 ... TIME_3</code>,</li>
  <li>In <code>N_RIPET_CAUSE</code> the number of repetitions of each <code>CAUSE</code>.</li>
  </ul>
  
  <p>I hope I explained.</p>