Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Limitting result without ROWNUM
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark D Powell  
View profile  
 More options Jan 19 2007, 7:24 pm
Newsgroups: comp.databases.oracle.misc
From: "Mark D Powell" <Mark.Pow...@eds.com>
Date: 19 Jan 2007 16:24:06 -0800
Local: Fri, Jan 19 2007 7:24 pm
Subject: Re: Limitting result without ROWNUM

Matthias Matker wrote:
> Vladimir M. Zakharychev schrieb:
> >> I have to limit the number of results without using ROWNUM or something
> >> like that. One hint was to use "JOIN".

> >> I have to select the 10 biggest persons from a table "persons"

> >> id, firstname, lastname, size, age

> >> WITHOUT using ROWNUM or "limitter" like this.

> >> Do you have any idea?

> >> Thanks a lot.

> > Strange requirement - care to explain why?

> It forbidden to use such "limiters", we ( students) should do this via a
> kind of "JOIN". We MUST do so.
> I have tried it for hours...

> > I'd suggest using RANK() or
> > DENSE_RANK() analytic functions for this, but you might consider them
> > "limiters", too, so...

> That's right ;-)

>  > How about just fetching the first 10 rows of the
> > result set and ignoring the rest?

> Cannot act like this.

> Thanks for your quick reply.

You can use a subquery to find the max(value) where the value selected
is not equal to the max(value) on the same table.  This will give you
the second highest value.  If you were to nest the subquery repeatedly
you can find the Nth highest value.  Then you could just select the
rows where size >= the sub-selected 10th value.  This is a horrible way
to write a query.

Learning assignments with restrictions like this are misguided at best
and in my opinion do not promote learning how to solve relational
database information retrieval problems efficiently.

HTH -- Mark D Powell --


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.