Re: "Display of specified number of records." - Mailing list pgsql-sql

From Richard Huxton
Subject Re: "Display of specified number of records."
Date
Msg-id 00e901c109e9$6326c640$1001a8c0@archonet.com
Whole thread Raw
In response to "Display of specified number of records."  (rajesh.prabhu@lycos.com (rajesh))
List pgsql-sql
From: "rajesh" <rajesh.prabhu@lycos.com>

> Hi,
>   I have got following simple SQL.
>   Select TestID from test where testname = ' ' order by testdate.
>
>   Suppose for argument sake there are 100 records and testID's are 1
> to 100.
>   Is it possible to modify this SQL so that it will display records
> from 10 to 50 and not any other records.

Robby Slaughter has given one solution in another reply.

If that's not quite what you're after, and you want the 10th to 50th results
from the above query you can do:

... order by testdate limit 40 offset 10;

This calculates the results and then throws away the first nine and anything
after the 50th.

- Richard Huxton



pgsql-sql by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re: SQL - histogram
Next
From: Jan Wieck
Date:
Subject: Re: can we write to a flat file from Postgresql procedure