title: How to group 3 columns into a single one in SQL
body: <p>I have a table that has three columns: myColumn, myColumn2 and myColumn3. The three columns can have a different value but they are all the same type.</p>
  
  <p>I need to do a join such that I merge all the items in the three columns and then group by</p>
  
  <p>If I had a single column, it would be done like this:</p>
  
  <pre><code>select distinct (myColumn), COUNT(myColumn) as 'TotalF' 
  from FormularioCorto 
  where idEvento = @idEvento and myColumn &lt;&gt; ''
  group by myColumn 
  </code></pre>
  
  <p>The question is:
  How do I do a TSQL statement that will allow for me to join the three columns and then group by?</p>
  
  <p>Edit: here is the sample data
  I have a table that has 3 columns with the same type</p>
  
  <pre><code>columna columnb columnc
  a              a       b
  b              a       b
  c              c       d
  </code></pre>
  
  <p>I need to run a tsql that will merge the 3 columns and group by, to get a result like    </p>
  
  <pre><code>newcolumn   count
  a             3
  b             3
  c             2
  d             1
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance</p>