Re: How to aggregates this data - Mailing list pgsql-sql

From Chad Wagner
Subject Re: How to aggregates this data
Date
Msg-id 81961ff50701101638v68f96965y2310a152d71f3d9@mail.gmail.com
Whole thread Raw
In response to Re: How to aggregates this data  ("Chad Wagner" <chad.wagner@gmail.com>)
List pgsql-sql
By the way, if you want to include that "incomplete" week before 12/1 (incomplete because it doesn't have a data point
forMonday) then you would do this:<br /><br /><br />select s1.asx_code, s1.wdate AS date, s1.low , s1.high, s2.open,
s3.close,s1.volume<br />from (select asx_code, date_trunc('week', date) AS wdate, min(date) AS bdate, max(date) AS
edate,min(low) AS low, max(high) AS high, SUM(volume) AS volume<br />      from sales_summaries <br />      group by
asx_code,date_trunc('week', date)) s1, sales_summaries s2, sales_summaries s3<br />where s1.bdate = s2.date<br />and
s1.asx_code=s2.asx_code<br/>and s1.edate = s3.date<br />and s1.asx_code=s3.asx_code ;<br /><br /><br /> 

pgsql-sql by date:

Previous
From: "Chad Wagner"
Date:
Subject: Re: How to aggregates this data
Next
From: "Marc Mamin"
Date:
Subject: a way to generate functions dynamically ?