title: Pivot MySQL table based on day of week column
body: <p>Have the data in this format in db</p>
  
  <pre><code>---------------------------------------------
  count | margin |    date    | week | day    |
  ---------------------------------------------
   230  |   140  | 2013-01-01 |  0   | Monday  |
  ----------------------------------------------
   500  |   340  | 2013-01-02 |  0   | Tuesday  |
  ----------------------------------------------
   200  |   240  | 2013-01-08 |  1   | Monday  |
  ----------------------------------------------
  </code></pre>
  
  <p>require out put is</p>
  
  <pre><code>-----------------------------------------------------------
  |   week  |   monday  |  tuesday  |  wednesday  | .........
  -----------------------------------------------------------
  |    0    |  230:140  |  500:340  |
  -----------------------------------------------------------   
  |    1    |  200:240  | 
  -----------------------------------------------------------
  </code></pre>
  
  <p>any help is appreciated</p>