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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: oracle last

Re: oracle last

From: Daniel Fink <daniel.fink_at_sun.com>
Date: Mon, 14 Jul 2003 14:56:48 -0600
Message-Id: <25920.337697@fatcity.com>


This is a multi-part message in MIME format.

--------------325737F414961A96C61FC0F4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Depending upon the version, you may be able to use the analytical functions (8.1.6+) to achieve what you want. I don't have a ready example, but the Oracle docs are pretty good. If you want a less elegant solution, use an inline query, sort by the reverse order (asc or desc depends on your requirements) and take the top 3. You can find examples of the Top-N approach on www.optimaldba.com/library.html. Either the Top-N Row or SQL Scripting Sorcery paper/presentation will have enough info to solve the problem.

pfeffer wrote:
>
> hi
> is there a statement like last in mysql ?
> last returns a specified number of rows from a select.
> means if i do a select and i want only the last 3 lines.
> thx
> martin
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: pfeffer
> INET: m.pfeffer_at_inode.at
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
--------------325737F414961A96C61FC0F4
Content-Type: text/x-vcard; charset=us-ascii;  name="daniel.fink.vcf"

Content-Transfer-Encoding: 7bit
Content-Description: Card for Daniel Fink
Content-Disposition: attachment;

 filename="daniel.fink.vcf"

begin:vcard
n:Fink;Daniel
tel;cell:303.808.3282
tel;work:303.272.3225
x-mozilla-html:TRUE
adr:;;;;;;
version:2.1
email;internet:daniel.fink_at_sun.com
title:DB Services Lead
x-mozilla-cpt:;-4832
fn:Daniel Fink
end:vcard Received on Mon Jul 14 2003 - 15:56:48 CDT

Original text of this message

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