title: Separating columns onto rows (pivot table?)
body: <p>Given a table row such as:</p>
  
  <pre><code>id  |  username  |  att7  |  att28  |  atttotal
  1   |   12345    |   77   |    88   |     99
  </code></pre>
  
  <p>Is there a way in SQL (I am using MySQL at the moment, but can be any database really) to convert that so that the output in my VIEW would be something like:</p>
  
  <pre><code>id  |  username  |  type  |  period      | value
  1   |   12345    |   Att  |    7 Days    |  77
  2   |   12345    |   Att  |    28 Days   |  88
  3   |   12345    |   Att  |    Total     |  99
  </code></pre>
  
  <p>I am reading about PIVOT tables at the moment, as I feel like that might be what is needed, but so far am not able to work out how I'd actually go about this..</p>
  
  <p>Cheers.</p>