title: How to get week start and end date string in PostgreSQL?
body: <p>I am using <strong>PostgreSQL 8.3</strong>. I have a table like this:</p>
  
  <pre><code>id        regist_time        result
  -----------------------------------
  1     2012-07-09 15:00:08      3
  2     2012-07-25 22:24:22      7
  4     2012-07-07 22:24:22      8
  </code></pre>
  
  <p><code>regist_time</code>'s data type is <code>timestamp</code>.</p>
  
  <p>I need to find a week time interval(start to end)
  and sum(result) as num.</p>
  
  <p>I want to get the result as:</p>
  
  <pre><code>      week                    num    
  ---------------------------------
  7/1/2012-7/7/2012              10
  7/8/2012-7/14/2012              5
  7/15/2012-7/21/2012             3
  7/22/2012-7/28/2012            11
  </code></pre>
  
  <p>I can get the week number just in this year:</p>
  
  <pre><code>SELECT id,regis_time, EXTRACT(WEEK FROM regis_time) AS regweek
  FROM tba
  </code></pre>
  
  <p>The key part is </p>
  
  <pre><code>EXTRACT(WEEK FROM regis_time) 
  </code></pre>
  
  <p>extract function can only get the week number in this year, how can I get start time to end time in one week?</p>