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

Home -> Community -> Usenet -> c.d.o.misc -> Re: A VERY DIFFICULT QUERY

Re: A VERY DIFFICULT QUERY

From: Matt Turner <--mturner_at_bigwig.net>
Date: Mon, 19 Jul 1999 19:19:46 +0100
Message-ID: <7mvqc6$d6f$1@news1.cableinet.co.uk>


Maybe he has just simplified a 'real world' problem.

The easiest way to approach this would be using an inline view.

Select *
from Emp,

        (
         Select Avg(Sal)  Salary
         from emp
         ) Av_Sal

Where EMP.Salary = Av_Sal.Salary

You may want to add a range on to the where clause.

Matt.

Kenneth C Stahl wrote in message <378DCAD6.6003C15D_at_Unforgettable.com>...
>This is one of the reasons I left Mensa. I just couldn't see the point
>in intellectual challenges for the sake of intellectual challenges.
>Posing a problem and then saying that answers are not acceptable if they
>use a particular technique fall into this category.
>
>If you want others to help solve a problem using a real world situation
>then there are probably many of us who are glad to help - but to ask for
>a solution to a problem such as this is simply an intellectual exercise
>and serves no real useful purpose.
>
>nooruddin wrote:
>
>> Hi!
>>
>> I want a sql query for the following result:
>>
>> From a table containing salaries (say emp table)
>>
>> I want the salary which is closest to the average of all the
>> salaries
>> (it seems easy at first look, but I assure you its not the case)
>>
>> NOTE:The query should be an sql statement and not a pl/sql script.
>> good luck..
>>
>> bye..
>
Received on Mon Jul 19 1999 - 13:19:46 CDT

Original text of this message

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