Re: [SQL] graphing time series data

2010-04-14 Thread Pavel Stehule
2010/4/14 Louis-David Mitterrand : > On Wed, Apr 14, 2010 at 06:06:59PM +0200, Pavel Stehule wrote: >> I don't understand well. Why you don't use a function date_trunc(), >> >> select date_trunc('week', created), count(*) >> from price >> group by date_trunc('week', created) > > Because if a price

Re: [SQL] graphing time series data

2010-04-14 Thread Louis-David Mitterrand
On Wed, Apr 14, 2010 at 06:06:59PM +0200, Pavel Stehule wrote: > I don't understand well. Why you don't use a function date_trunc(), > > select date_trunc('week', created), count(*) > from price > group by date_trunc('week', created) Because if a price doesn't change for more than a week, then so

Re: [SQL] graphing time series data

2010-04-14 Thread Pavel Stehule
2010/4/14 Louis-David Mitterrand : > On Wed, Apr 14, 2010 at 08:46:13AM -0700, Richard Broersma wrote: >> On Wed, Apr 14, 2010 at 7:54 AM, Louis-David Mitterrand >> wrote: >> >> > Now, I'd like to make a graph of average prices per week, per >> > id_product. As some prices don't vary much, distrib

Re: [SQL] graphing time series data

2010-04-14 Thread Louis-David Mitterrand
On Wed, Apr 14, 2010 at 08:46:13AM -0700, Richard Broersma wrote: > On Wed, Apr 14, 2010 at 7:54 AM, Louis-David Mitterrand > wrote: > > > Now, I'd like to make a graph of average prices per week, per > > id_product. As some prices don't vary much, distribution would not be > > ideal if I simply

Re: [SQL] graphing time series data

2010-04-14 Thread Richard Broersma
On Wed, Apr 14, 2010 at 7:54 AM, Louis-David Mitterrand wrote: > Now, I'd like to make a graph of average prices per week, per > id_product. As some prices don't vary much, distribution would not be > ideal if I simply 'group by extract(week from p.modified)'. I created a view for a similar prob