Re: need some help on figuring out how to write a query - Mailing list pgsql-general

From Jorge Godoy
Subject Re: need some help on figuring out how to write a query
Date
Msg-id 200802231047.44377.jgodoy@gmail.com
Whole thread Raw
In response to Re: need some help on figuring out how to write a query  (Justin <justin@emproshunts.com>)
List 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@gmail.com>


pgsql-general by date:

Previous
From: "Kynn Jones"
Date:
Subject: Re: PostgreSQL's hashing function?
Next
From: "Osvaldo Kussama"
Date:
Subject: Re: joining on concatonation?