Re: Max rows
Posted in 1999
>How can I select the X (let's say 10) max rows (based on a given
criteria:
>the value of a field) in a table with Informix 4GL and/or standard
SQL ?
One or more of the variants of the server (I think IDS 7.3, 8.x and
engines with Advance Decision Support) have functionality built in. I
don't know the syntax off the top of my head, but it's something like
SET FIRST n;
In 4GL, build a cursor in descending order and only read the first 10
rows.
In dbaccess, try
dbaccess dbname scriptname | grep out all headers, etc | head -10
where scriptname is more or less the same select you would have used
in the 4GL solution.
HTH.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com