Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Is it possible to have a max function in SQL that exlcudes outliners(values 20x average)

Re: Is it possible to have a max function in SQL that exlcudes outliners(values 20x average)

From: Conan Farrell <conan_at_>
Date: 2000/07/19
Message-ID: <SIid5.8553$r4.4370@news.indigo.ie>#1/1

try this

    select a.account, max(a.amount)

        from table a,
                (select account, avg(amount) check1
                     from table
                    where somedate between start and end
                    group by acount) b
    where
        a.somedate between start and end
        and a.account =b.account
        and a.amount between (b.check1 * 0.8) and (b.check1 *1.2)
    group by a.account

HTH Conan

dsad wrote in message ...
>we need to get max of a value for an account over a time period, but we
 want
>to exclude any values that are 20x greater or less than average for that
>account over the period
>
>any ideas?
Received on Wed Jul 19 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US