× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Oops, I gotta remember to read the WHOLE message before I reply...

I think for five results for EACH status *could* be done in V5R4 with the ranking functions... I'm stuck at V5R3, so I'm afraid I can't show you the syntax.

I'm sure Birgitta has posted numerous examples of the required functions.

Eric

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of DeLong, Eric
Sent: Tuesday, July 31, 2007 4:11 PM
To: Midrange Systems Technical Discussion
Subject: RE: Limiting SQL results returned


Append this to the end of your select statement:

fetch first 5 rows only

Eric

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Jim Essinger
Sent: Tuesday, July 31, 2007 3:55 PM
To: Midrange Systems Technical Discussion
Subject: Limiting SQL results returned


SQL Guru's

Is there a way to limit the number of rows returned from a SQL statement?
For instance, I want a sampling of 5 records for each status from a file.

Status, Fn1, .... Fn6

For _each_ status that appears in the file, I want 5 and only 5 resulting
rows, could be the first 5 or last 5 or a random 5 - although a random 5
would be awesome - would help with another project I have ahead of me.
There could be 20 different status codes in the file, and I want 5 records
for all 20 status codes. I guess that there might not be 5 for some
statuses, so getting up to 5 results would be OK too.

Any thoughts?

Jim

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.