Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: selecting the last 10 rows...
In article <741ott$fl1$2_at_newsreader5.core.theplanet.net>,
"Neil Hulin" <nospam@*NOSPAM*litech.freeserve.co.uk> wrote:
> Why do you want to select the last ten rows (or the
> first ten rows for that matter)?
>
I often use it to look at the last 10 rows in a log files (each row is time
stamped and ordered). I have developed a somewhat generic PL/SQL using SQL
Tables to extract the last n rows from a list of possibles which are then
presented in the normal sequence (nth from end, nth-1 from end,... last row).
In fact, I am separating out several jobs logs and isolating the last 10 rows.
It is a bit odd, but it does work. The idea of just ordering in descending order could work if there is only one set. With multiple sets of data, one needs to order by each set and extract the nth last from each set. A simple order by will not work.
If anyone is interested in the code -- email me.
> If this is a design requirement then there should be a
> better definition of how to identify the candidate
> rows. It sounds like fuzzy analysis to me - someone
> doesn't understand the problem or does understand the
> problem but couldn't define the correct solution. If
> you can come up with a correct definition and solution
> then your resulting SQL should be easily implemented
> and probably much more efficient than the solutions
> proposed here.
>
> --
> ...neil {actually: neil [dot] hulin [at] litech [dot]
> freeserve [dot] co [dot] uk}
>
>
--
Michael Krolewski
mikkro_at_hbsi.com
All opinions are my own, and do not represent my employer.
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Dec 03 1998 - 02:31:43 CST
![]() |
![]() |