pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
"Display of specified number of records."
4+ messages / 4 participants
[nested] [flat]

* "Display of specified number of records."
@ 2001-07-06 10:47 rajesh <rajesh.prabhu@lycos.com>
  2001-07-10 17:13 ` Re: "Display of specified number of records." Gene the Dancing Machine <lotsastamina@hotmail.com>
  2001-07-11 02:51 ` RE: "Display of specified number of records." Robby Slaughter <webmaster@robbyslaughter.com>
  2001-07-11 09:10 ` Re: "Display of specified number of records." Richard Huxton <dev@archonet.com>
  0 siblings, 3 replies; 4+ messages in thread

From: rajesh.prabhu@lycos.com @ 2001-07-06 10:47 UTC (permalink / raw)
  To: pgsql-sql

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.

Rajesh.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: "Display of specified number of records."
  2001-07-06 10:47 "Display of specified number of records." rajesh <rajesh.prabhu@lycos.com>
@ 2001-07-10 17:13 ` Gene the Dancing Machine <lotsastamina@hotmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: lotsastamina@hotmail.com @ 2001-07-10 17:13 UTC (permalink / raw)
  To: pgsql-sql

Use "<",  ">" and "AND" after the "WHERE" to filter your return. This
works only if your testID is Serialized (ie 1,2,3). If they are
uniqueID's, another field must be used in it's place....



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* RE: "Display of specified number of records."
  2001-07-06 10:47 "Display of specified number of records." rajesh <rajesh.prabhu@lycos.com>
@ 2001-07-11 02:51 ` Robby Slaughter <webmaster@robbyslaughter.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Robby Slaughter @ 2001-07-11 02:51 UTC (permalink / raw)
  To: rajesh <rajesh.prabhu@lycos.com>; pgsql-sql

You want to just display records WHERE the field is BETWEEN
10 and 50?

SELECT * FROM test WHERE testID BETWEEN 10 AND 50;

If you want them to be ordered by the testID, just include a ORDER BY
testID;

See, isn't SQL a friendly language? :-)

-Robby

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.

Rajesh.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: "Display of specified number of records."
  2001-07-06 10:47 "Display of specified number of records." rajesh <rajesh.prabhu@lycos.com>
@ 2001-07-11 09:10 ` Richard Huxton <dev@archonet.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Richard Huxton @ 2001-07-11 09:10 UTC (permalink / raw)
  To: rajesh <rajesh.prabhu@lycos.com>; 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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2001-07-11 09:10 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-06 10:47 "Display of specified number of records." rajesh <rajesh.prabhu@lycos.com>
2001-07-10 17:13 ` Gene the Dancing Machine <lotsastamina@hotmail.com>
2001-07-11 02:51 ` Robby Slaughter <webmaster@robbyslaughter.com>
2001-07-11 09:10 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox