Re: SQL question

From: nijlpaard <nijlpaard_at_mail.com>
Date: Thu, 9 Nov 2000 09:06:31 GMT
Message-ID: <G3r2M9.8x1_at_ahisinfr.xs4all.nl>


Andrew Pahomov has written in <3a09750c$1_at_miik2-ilt.ilt.kharkov.ua>...
> Nijlpaard wrote
>> Using inline views solves this problem quite easy. Although we're not
 able
>> to order in inline views before Oracle 8 we can distinguish the top 3
>> salaried people by using nested inline views and the group by function.
>>
>> The first inline view is used for distinguishing the best salary
 (top1_sal)
>> for each department. In the second inline view we select the second best
>> salary (top2_sal); in the third inline view we select the third best
 salary
>> (top3_sal). By comparing the salaries with these inline views we get the
>> desired result without using explicit ordering, rownums or functions.
>>
>> The statement below wil answer your question!
>>
>> Good luck,
>>
>> Nellie
>>
>
>Well, thats fine, but if nedeed to select top 2000 and more employers.
>That will be query with 2000 or more inline views;)

You're completely right and fortunately that was not the problem "xdba_at_my-deja.com" had to solve ;-)

But in Oracle 7 we're not able to use the order by clause in inline views, so we had to find another solution. Two options left; using a function or nested inline views. Using a function in a select statement is rather expensive when a lot of rows are returned. So in this case I'd prefer the nested inline views solution which is less data dependend. Received on Thu Nov 09 2000 - 10:06:31 CET

Original text of this message