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

Home -> Community -> Usenet -> comp.databases.theory -> Best method to SELECT TOP n TO m of a table

Best method to SELECT TOP n TO m of a table

From: Will Clark <reply_only_to_newsgroup_please_at_noone-lives-here.com>
Date: Tue, 4 Nov 2003 14:15:04 +0000 (UTC)
Message-ID: <bo8c98$orc$1@hercules.btinternet.com>


Hi there,

I was wondering if there was a better way to do a SELECT where it returns not the TOP 5 (or whatever) but, say, the TOP 6 to 8?

What I've currently got is...

SELECT TOP 3 * FROM table WHERE

    id NOT IN (SELECT TOP 5 id FROM table ORDER BY id)     ORDER BY id

While this is ok for this (simple) query, it can get quite messy if the query is more complex. There must be a better way of doing it, mustn't there?

Thanks for any help :o)

Will Received on Tue Nov 04 2003 - 08:15:04 CST

Original text of this message

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