Re: need some help on figuring out how to write a query

From: Jorge Godoy <jgodoy(at)gmail(dot)com>
To: Justin <justin(at)emproshunts(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: need some help on figuring out how to write a query
Date: 2008-02-23 13:47:43
Message-ID: 200802231047.44377.jgodoy@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Em Friday 22 February 2008 13:10:20 Justin escreveu:
> I'm not after small code i'm after maintainable code where the date
> range for this report would be always changing. So if i can get it to
> one select statement i would on have to pass in some variables and it
> would create the moving average. Plus what if the sales people decide
> they want to change moving average from 10 weeks to 5 weeks or change it
> to 15 weeks. People drive me nuts with i want it to do this or that ,
> Of course they have no idea how complicated it sometimes to get what
> they want.

Then just add more parameters to your function. Instead of just start date
also include an optional period, in weeks, days, hours, whatever you think is
the better granularity for this.

So, in your interface, add the period and make "10" the default value.

--
Jorge Godoy <jgodoy(at)gmail(dot)com>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Osvaldo Kussama 2008-02-23 15:30:33 Re: joining on concatonation?
Previous Message Kynn Jones 2008-02-23 13:41:38 Re: PostgreSQL's hashing function?