Subject Re: [ib-support] Reducing the numbers of records returned
Author Helen Borrie
At 01:46 PM 07-06-02 +0000, you wrote:
>All,
>Is it possible, and if so how, to reduce the number of record
>returned by a query without changing the query?
>
>For exmaple if I had a table called table1 that contained 10,000
>records and I wrote a query of : select field1, field2 from table1.
>This obviously will return all of the records, but what I want to do
>is have that query but reduce the result set to say ten records. I
>want to do this because I'm writting a front end screen that will
>allow my clients to query the database and I want to have a feature
>of letting them view sample data from the query that they write.

If you are using Firebird, then in the code where you construct the SQL
statement, interpose the keywords "FIRST 10" between "SELECT" and the first
column name of the output list, e.g. (your example)

select FIRST 10 field1, field2 from table1

You could add an ORDER BY clause if you wanted them to sample a
"meaningful" selection, although it sounds as if your requirements don't
care too much which 10 rows they get.

heLen

All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________