Thread: limiting rows in an query

limiting rows in an query

From
Felipe Schnack
Date:
  In MySQL I can get the first 30 rows in an query doing this:
  SELECT * FROM `inscricoes` LIMIT 0, 30
  How I do this in pgsql?
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
felipes@ritterdosreis.br
Fone/Fax.: (51)32303328


Re: limiting rows in an query

From
Varun Kacholia
Date:
Hi ,

 Postgresql also follows the same syntax.

 SELECT select_list
     FROM table_expression
         [LIMIT { number | ALL }] [OFFSET number]

On Mon, Sep 30, 2002 at 10:09:15AM -0300, Felipe Schnack wrote:
>   In MySQL I can get the first 30 rows in an query doing this:
>   SELECT * FROM `inscricoes` LIMIT 0, 30
>   How I do this in pgsql?
> --
>
> Felipe Schnack
> Analista de Sistemas
> felipes@ritterdosreis.br
> Cel.: (51)91287530
> Linux Counter #281893
>
> Faculdade Ritter dos Reis
> www.ritterdosreis.br
> felipes@ritterdosreis.br
> Fone/Fax.: (51)32303328
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: 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

--
Varun
------
Do not kill time ... else time will kill you


Re: limiting rows in an query

From
Michael Paesold
Date:
Felipe Schnack wrote:
>   In MySQL I can get the first 30 rows in an query doing this:
>   SELECT * FROM `inscricoes` LIMIT 0, 30
>   How I do this in pgsql?

SELECT * FROM "inscricoes" LIMIT 30 OFFSET 0;

Best regards, Michael Paesold

--
Werden Sie mit uns zum "OnlineStar 2002"! Jetzt GMX wählen -
und tolle Preise absahnen! http://www.onlinestar.de


Re: limiting rows in an query

From
Felipe Schnack
Date:
  I think there isn't a portable way.
  In Oracle each row of a query have a sequential number, called
"rowid", I think.
  So, in oracle you do somethink like
  ...AND ROWID >= 0 AND ROWID <20
  Disgusting, isn't it? :-)

On Mon, 2002-09-30 at 13:55, David Wall wrote:
> Does anybody know how to do this in a "portable" way?  For example, I don't
> think Oracle has the LIMIT clause capability...
>
> David
>
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
felipes@ritterdosreis.br
Fone/Fax.: (51)32303328


Re: limiting rows in an query

From
snpe
Date:
This query (in Oracle) return nothing always
ROWID is unique key and have another form (18 chars) and for two consecutive
rows don't must conescutive ROWID.
regrads

In postgresql jdbc mising get/setFetchSize for Statement (now getFetchSize
return complete query size and for big query we have 'out of memory')
We can user LIMIT, but in another party software (IDE, J2EE server) we must
have setFetchSize)

regards
haris peco

On Monday 30 September 2002 06:56 pm, Felipe Schnack wrote:
>   I think there isn't a portable way.
>   In Oracle each row of a query have a sequential number, called
> "rowid", I think.
>   So, in oracle you do somethink like
>   ...AND ROWID >= 0 AND ROWID <20
>   Disgusting, isn't it? :-)
>
> On Mon, 2002-09-30 at 13:55, David Wall wrote:
> > Does anybody know how to do this in a "portable" way?  For example, I
> > don't think Oracle has the LIMIT clause capability...
> >
> > David


Re: limiting rows in an query

From
"David Wall"
Date:
Does anybody know how to do this in a "portable" way?  For example, I don't
think Oracle has the LIMIT clause capability...

David


Re: limiting rows in an query

From
Felipe Schnack
Date:
  There isn't a portable way.

On Mon, 2002-09-30 at 13:55, David Wall wrote:
> Does anybody know how to do this in a "portable" way?  For example, I don't
> think Oracle has the LIMIT clause capability...
>
> David
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
felipes@ritterdosreis.br
Fone/Fax.: (51)32303328


Re: limiting rows in an query

From
Felipe Schnack
Date:
  This isn't the same thing.

On Fri, 2002-10-04 at 10:13, Dave Cramer wrote:
> Once we get it working you can use setFetchSize
>
> Dave
> On Mon, 2002-09-30 at 12:55, David Wall wrote:
> > Does anybody know how to do this in a "portable" way?  For example, I don't
> > think Oracle has the LIMIT clause capability...
> >
> > David
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >
> >
>
>
>
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
felipes@ritterdosreis.br
Fone/Fax.: (51)32303328


Re: limiting rows in an query

From
Dave Cramer
Date:
Once we get it working you can use setFetchSize

Dave
On Mon, 2002-09-30 at 12:55, David Wall wrote:
> Does anybody know how to do this in a "portable" way?  For example, I don't
> think Oracle has the LIMIT clause capability...
>
> David
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>