title: Grouping data by weeks Oracle
body: <p>I have a result from a query with the following columns.
  Name, Value , Location , date
  I want to have two more column with start date and end date .The start date is Friday of the week and end date is next Thursday. week starts from 07/19/2013.I want to group the date column.
  i tried using WITH clause to generate the weeks,but I have to make a Cartesian join and the connection breaks.</p>
  
  <pre><code>  WITH Q1 AS
  ( SELECT dates AS start_date , dates + 6 AS end_date FROM
          (SELECT DATE '2013-07-18' + LEVEL-1  dates FROM DUAL CONNECT BY LEVEL &lt;= (TRUNC(SYSDATE)- DATE '2013-07-18'))
       WHERE TO_CHAR( dates,'DY') = 'FRI'
  )
  Select q1.Start_date, q1.end_date, t.name, t.value, t.date
  from test1 t,Q1
  where date between q1.start_date and Q1.end_date;
  </code></pre>
  
  <p>I have exadata on which this Cartesian join works all fine,but not on other database.</p>
  
  <p>The output should be </p>
  
  <pre><code>Start date End date    Name  value   Date
  ---------- --------    ----  -----   -------- 
  07/19/2013 07/25/2013   A       5      07/22/2013
  07/19/2013 07/25/2013   b       3      07/23/2013
  07/26/2013 08/01/2013   c       6      08/01/2013
  08/02/2013 08/08/2013   A       2      08/06/2013
  ---
  --
  -- 
  11/29/2013 12/05/2013   t       5      12/01/2013
  11/29/2013 12/05/2013   s       3      12/02/2013
  11/29/2013 12/05/2013   t       5      12/02/2013
  </code></pre>