Re: [HACKERS] SELECT ... LIMIT (trial implementation)

Поиск
Список
Период
Сортировка
От Oleg Bartunov
Тема Re: [HACKERS] SELECT ... LIMIT (trial implementation)
Дата
Msg-id Pine.GSO.3.96.SK.981018213213.17519C-100000@ra
обсуждение исходный текст
Ответ на Re: [HACKERS] SELECT ... LIMIT (trial implementation)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] SELECT ... LIMIT (trial implementation)
Список pgsql-hackers
On Sun, 18 Oct 1998, Tom Lane wrote:

> Date: Sun, 18 Oct 1998 12:04:49 -0400
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: Bruce Momjian <maillist@candle.pha.pa.us>
> Cc: pgsql-hackers@postgreSQL.org
> Subject: Re: [HACKERS] SELECT ... LIMIT (trial implementation)
>
> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> > What if someone wants the rows from 500 to the end.  Should we allow
> > the syntax to be:
> >          SELECT ... [LIMIT count] [OFFSET offset]
> > LIMIT and OFFSET are independent.
>
> I like that syntax the best, but remember we are not inventing in
> a green field here.  Isn't this a feature that already exists in
> other DBMs?  We should probably copy their syntax, unless it's
> truly spectacularly awful...
>
>             regards, tom lane
>

Mysql uses LIMIT [offset,] rows
From documentation:

      LIMIT takes one or two numeric arguments. A single argument
      represents the maximum number of rows to return in a result. If two
      arguments are given the first argument is the offset to the first row to
      return, while the second is the maximum number of rows to return in the
      result.

What would be nice if somehow total number of rows could be returned.
This is often needed for altavista-like application.
Of course, I can do
select count(*) from sometable ... LIMIT offset, rows
and then
select ... from sometable ... LIMIT offset, rows
but this seems not elegant solution.

    Regards,

        Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Anyone object to simplifying INSTALL instructions?
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: [HACKERS] SELECT ... LIMIT (trial implementation)