Re: limit 0,10 within SELECT ..... FROM ......

From: Darren Ferguson <darren(at)crystalballinc(dot)com>
To: Paul Ottar Tornes <critical(at)tiscali(dot)no>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: limit 0,10 within SELECT ..... FROM ......
Date: 2002-11-01 14:17:48
Message-ID: Pine.LNX.4.44.0211010916310.19663-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You should use offset this will help you in this

Select id, tittel, dato, kilde, referat FROM nyheter order by id desc
limit 5 offset 5

will return 5 - 9 i think or 10 but this is how you should use it

do \h select when in psql interface to view select command

HTH
On Fri, 1 Nov 2002, Paul Ottar Tornes wrote:

> 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?!
>
> Regards
>
> Paul Ottar Tornes
>

--
Darren Ferguson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Ottar Tornes 2002-11-01 14:20:17 limit 0,10 within SELECT ..... FROM ......
Previous Message Doug McNaught 2002-11-01 13:50:54 Re: 7.2.3: tuple is too big (max 8136)