| From: | Lee Kindness <lkindness(at)csl(dot)co(dot)uk> |
|---|---|
| To: | "Paul Ottar Tornes" <critical(at)tiscali(dot)no> |
| Cc: | Lee Kindness <lkindness(at)csl(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org |
| Subject: | limit 0,10 within SELECT ..... FROM ...... |
| Date: | 2002-11-01 14:21:06 |
| Message-ID: | 15810.36306.101194.503590@kelvin.csl.co.uk |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Probably because you're really wanting to do:
SELECT id, tittel, dato, kilde, referat
FROM nyheter ORDER BY desc LIMIT 10, 0
(i.e. got the arguments the wrong way round) It's much more intuitive
to use the "LIMIT n OFFSET m" syntax.
Lee.
Paul Ottar Tornes writes:
> I run PostgreSQL and have some questions:
>
>
> How come
> $query = "SELECT id, tittel, dato, kilde, referat FROM nyheter order by id desc limit 0,10";
> Does not display any posts in my news script, but
> $query = "SELECT id, tittel, dato, kilde, referat FROM nyheter order by id desc limit 10";
> Shows the last 10.?
>
> And:
>
> How come
> $query = "SELECT id, tittel, dato, kilde, referat FROM nyheter order by id desc limit 10,20";
> Displays posts 5 to 14, and not 10 to 20?!
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Roberto de Amorim | 2002-11-01 14:43:47 | pg_restore error |
| Previous Message | Paul Ottar Tornes | 2002-11-01 14:20:17 | limit 0,10 within SELECT ..... FROM ...... |