|
Home > Archive > PostgreSQL SQL > February 2006 > restircting rows
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| padmanabha konkodi 2006-02-25, 9:48 am |
|
hi all,
my query return 100 rows but if i am intrested only from 40-60 rows then how to restrict.
for example
select * from students (returns 100 rows).but i am intrested only rows from 40 to 60.
| |
| A. Kretschmer 2006-02-25, 9:48 am |
| am 22.02.2006, um 9:06:57 -0000 mailte padmanabha konkodi folgendes:
>
>
> hi all,
>
> my query return 100 rows but if i am intrested only from 40-60 rows then how to restrict.
>
> for example
>
> select * from students (returns 100 rows).but i am intrested only rows from 40 to 60.
select * from students limit 20 offset 40;
HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
| |
| Richard Huxton 2006-02-25, 9:48 am |
| padmanabha konkodi wrote:
>
>
> hi all,
>
> my query return 100 rows but if i am intrested only from 40-60 rows
> then how to restrict.
>
> for example
>
> select * from students (returns 100 rows).but i am intrested only
> rows from 40 to 60.
SELECT * FROM student ORDER BY something LIMIT 20 OFFSET 40;
Be aware that this will have to fetch 60 rows and throw the first 40 away.
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly
| |
| Michael Glaesemann 2006-02-25, 9:48 am |
|
On Feb 22, 2006, at 18:06 , padmanabha konkodi wrote:
> my query return 100 rows but if i am intrested only from 40-60 rows
> then how to restrict.
>
> for example
>
> select * from students (returns 100 rows).but i am intrested only
> rows from 40 to 60.
See LIMIT and OFFSET.
http://www.postgresql.org/docs/8.1/....html#SQL-LIMIT
Michael Glaesemann
grzm myrealbox com
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
|
|
|
|
|