Thread: RE: [GENERAL] limit select question

RE: [GENERAL] limit select question

From
Michael Davis
Date:
Select * From table_name limit 1;

    -----Original Message-----
    From:    Kevin Heflin [SMTP:kheflin@shreve.net]
    Sent:    Tuesday, March 30, 1999 10:00 PM
    To:    PGSQL-General (E-mail)
    Subject:    [GENERAL] limit select question


    I've been asked if there is a way to LIMIT the number of results
displayed
    when doing a SELECT with postgresql, by a former user of mysql.
Wasn't
    sure if there is an easy way to do this or not. I've don't it
before, but
    in a very round about way... any suggestions.

    > with mySQL and SELECT queries
    > you can LIMIT the number of results displayed to the screen. I
can't
    > seem to find any such switch in the SELECT commands in postgres.


    Kevin


    --------------------------------------------------------------------
    Kevin Heflin          | ShreveNet, Inc.      | Ph:318.222.2638 x103
    VP/Mac Tech           | 333 Texas St #619    | FAX:318.221.6612
    kheflin@shreve.net    | Shreveport, LA 71101 | http://www.shreve.net
    --------------------------------------------------------------------


RE: [GENERAL] limit select question

From
Kevin Heflin
Date:
On Wed, 31 Mar 1999, Michael Davis wrote:

> Select * From table_name limit 1;

I'm running postgres6.4.2, and this query fails with:
ERROR:  parser: parse error at or near "1"

I was told I could gain this feature by adding the 6.4.2 feature patch.
But when I tried installing the patch, anything and everything I tried in
psql failed with an error on 'select'

Kevin


--------------------------------------------------------------------
Kevin Heflin          | ShreveNet, Inc.      | Ph:318.222.2638 x103
VP/Mac Tech           | 333 Texas St #619    | FAX:318.221.6612
kheflin@shreve.net    | Shreveport, LA 71101 | http://www.shreve.net
--------------------------------------------------------------------


RE: [GENERAL] limit select question

From
"Rudy Gireyev"
Date:
May be I'm missing something, but why not use the cursor?
Do the select once and then fetch as many rows as you need.

Rudy

On 31 Mar 99, at 1:20, Michael Davis wrote:

> Select * From table_name limit 1;
>
>  -----Original Message-----
>  From:    Kevin Heflin [SMTP:kheflin@shreve.net]
>  Sent:    Tuesday, March 30, 1999 10:00 PM
>  To:    PGSQL-General (E-mail)
>  Subject:    [GENERAL] limit select question
>
>
>  I've been asked if there is a way to LIMIT the number of results
> displayed
>  when doing a SELECT with postgresql, by a former user of mysql.
> Wasn't
>  sure if there is an easy way to do this or not. I've don't it
> before, but
>  in a very round about way... any suggestions.
>
>  > with mySQL and SELECT queries
>  > you can LIMIT the number of results displayed to the screen. I
> can't
>  > seem to find any such switch in the SELECT commands in postgres.
>
>
>  Kevin
>
>
>  --------------------------------------------------------------------
>  Kevin Heflin          | ShreveNet, Inc.      | Ph:318.222.2638 x103
>  VP/Mac Tech           | 333 Texas St #619    | FAX:318.221.6612
>  kheflin@shreve.net    | Shreveport, LA 71101 | http://www.shreve.net
>  --------------------------------------------------------------------
>
>
>