title: group sql results by substring
body: <p>I have a table with some records where a column represents the group of every record:</p>
  
  <pre><code>id  | group
  1     abc_xxx
  2     abc_yyy
  3     def_ooo
  4     def_ppp
  5     ghi_jjj
  6     ghi_kkk
  </code></pre>
  
  <p>When I do a query and group the rows by the group column, I get</p>
  
  <pre><code>abc_xxx
  abc_yyy
  def_ooo
  def_ppp
  ghi_jjj
  ghi_kkk
  </code></pre>
  
  <p>However it's not the correct output that I need, I need to get instead something like that:</p>
  
  <pre><code>abc
  def
  ghi
  </code></pre>
  
  <p>Because it represents the real classification  of the records under the group column. So I'm looking for a method in SQL Server 2005 with which I can get that.</p>