title: sql - count records per weeks using timestamp
body: <p>I have the table named 'tasaciones' which has 2 columns 'record' and 'fecha' (fecha is timestamp).</p>
  
  <pre><code>record  | fecha
  -----------------------------
  
  record1 | 2015-10-09 11:24:52
  
  record1 | 2015-11-09 11:31:52
  
  record2 | 2015-17-09 11:37:17
  
  record3 | 2015-25-09 12:03:31
  
  record3 | 2015-26-09 12:03:31
  
  record4 | 2015-10-10 12:23:25
  
  record4 | 2015-11-10 12:27:25
  </code></pre>
  
  <p>I need to make weekly report by counting records per weeks from the date of first record until the current time.
  I found something like this but even if this is what I need, I don't know how to write 'while' to <code>echo</code> the data.</p>
  
  <pre><code>SELECT year(fecha), datepart(week, fecha), count(*)
  FROM tasaciones
  GROUP BY year(fecha), datepart(week, fecha)
  </code></pre>
  
  <p>I want to get results like this:</p>
  
  <p>week 1: 15 records</p>
  
  <p>week 2: 10 records</p>
  
  <p>week 3: 25 records</p>
  
  <p>week 4: 25 records</p>