Обсуждение: Howto only select secific lines from a result?

Поиск
Список
Период
Сортировка

Howto only select secific lines from a result?

От
Clemens Eisserer
Дата:
Hi,

I am working on a graphical table display widget which should be able
to display huge amounts of data, by lazy-loading database values. It
already works well if the primary-key and line-number are equal.
However I don't have any idea howto handle the case where the
primary-key contains holes, caused e.g. by deleting a few entries.

What I would need is a LIMIT command, which allows to LIMIT the
results in two ways.
Is there some way to select only specific lines from a result, something like:
Select * from table Where RESULNR BETWEEN 1000 and 1040?

Or do you have any other ideas howto solve this problem?

Thank you in advance, Clemens

Re: Howto only select secific lines from a result?

От
Thom Brown
Дата:
On 8 August 2010 02:37, Clemens Eisserer <linuxhippy@gmail.com> wrote:
> Hi,
>
> I am working on a graphical table display widget which should be able
> to display huge amounts of data, by lazy-loading database values. It
> already works well if the primary-key and line-number are equal.
> However I don't have any idea howto handle the case where the
> primary-key contains holes, caused e.g. by deleting a few entries.
>
> What I would need is a LIMIT command, which allows to LIMIT the
> results in two ways.
> Is there some way to select only specific lines from a result, something like:
> Select * from table Where RESULNR BETWEEN 1000 and 1040?
>
> Or do you have any other ideas howto solve this problem?
>
> Thank you in advance, Clemens
>
> --

http://www.postgresql.org/docs/8.4/static/queries-limit.html

--
Thom Brown
Registered Linux user: #516935

Re: Howto only select secific lines from a result?

От
Alban Hertroys
Дата:
On 8 Aug 2010, at 3:37, Clemens Eisserer wrote:

> What I would need is a LIMIT command, which allows to LIMIT the
> results in two ways.
> Is there some way to select only specific lines from a result, something like:
> Select * from table Where RESULNR BETWEEN 1000 and 1040?
>
> Or do you have any other ideas howto solve this problem?


I think cursors are what you're looking for. Start reading from:
http://www.postgresql.org/docs/8.4/interactive/sql-declare.html

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4c5e73eb286211213419466!