Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: sum of a column (development question)
Well, I see your point but ntile divides the data into a number of groups
based on an argument in you give it. He wants the data from this year and
last year, and the between statement with a group by, order by is the
logical way to get that, without any recoding required. The use of ntile
would not only be redundant, but require an additional calculation to
determine the number of buckets to use. If he wants to modify the sql to
allow quarterly or monthly data, a roll up would do that without requiring
additional calculations to determine the number of groupings needed.
On 9/12/07, August Spier <gspier_at_chiliad.com> wrote:
>
> Perhaps I am mistaken. use of analytic functions will leave the developer
> with a way forward if/when the requirements change (two years, three years,
> by quarter, whatever) and prevent the need to recode. In addition, the
> exercise strengthens the developer's ability with analytic functions.
> It's only a suggestion ...
>
> r,
>
> Gus
>
> On Sep 12, 2007, at 8:51 AM, Andrew Kerber wrote:
>
> You lost me on that one. How would ntile apply when he just wants totals
> for this year and last year?
>
> On 9/11/07, August Spier < gspier_at_chiliad.com> wrote:
> >
> > I was under the impression that NTILE would be more useful ...
> > especially if you are in a development cycle and requirements for more sql
> > statements are going to surface.
> > See http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions101.htm#sthref1696
> >
> >
> > r,
> >
> > Gus
> >
> >
>
-- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.' -- http://www.freelists.org/webpage/oracle-lReceived on Wed Sep 12 2007 - 09:48:12 CDT