Re: "Display of specified number of records."

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: "rajesh" <rajesh(dot)prabhu(at)lycos(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: "Display of specified number of records."
Date: 2001-07-11 09:10:51
Message-ID: 00e901c109e9$6326c640$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

From: "rajesh" <rajesh(dot)prabhu(at)lycos(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message rocael 2001-07-11 09:39:48 File system level backup
Previous Message Richard Huxton 2001-07-11 09:06:15 Re: SQL - histogram