title: How Do I Convert Horizontal Data Into Two Separate Vertical Tables With Conditions in MS SQL 2005
body: <p>I have a sort of brute for solution for the following problem, but I'm sure someone here will have an elegant solution.</p>
  
  <p>I have the following horizontally oriented table.</p>
  
  <pre><code>| Person  | Trait1 | Trait2 |
  | Patrick | .3     | .4     |
  | James   | .7     | .3     |
  | Kristin | .9     | .2     |
  </code></pre>
  
  <p>I would ideally like to separate the above into two vertical tables based on the traits. There would be two vertical tables, Bad and Terrible.</p>
  
  <p>If .4 &lt;= Trait1 &lt; .6 -> Bad,  Trait1 >= .7 -> Terrible</p>
  
  <p>If .3 &lt;= Trait2 &lt; .5 -> Bad, Trait2 >= .9 -> Terrible</p>
  
  <p>Using these conditions, we would then get the following tables</p>
  
  <pre><code>BAD
  |Person   | Trait  | Value |
  | Patrick | Trait2 | .4    | 
  | James   | Trait2 | .3    |
  
  Terrible
  |Person  | Trait  | Value |
  |James   | Trait1 | .7    | 
  |Kristin | Trait1 | .9    |
  </code></pre>