Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux