Re: Is this query possible in PostgreSQL ?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Is this query possible in PostgreSQL ?
Дата
Msg-id 200207290325.g6T3PoR27735@candle.pha.pa.us
обсуждение исходный текст
Ответ на Is this query possible in PostgreSQL ?  ("Ben-Nes Michael" <miki@canaan.co.il>)
Ответы Re: Is this query possible in PostgreSQL ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Ben-Nes Michael wrote:
> Hi All
>
> While reading some SQL books i crossed on SUBSETS querry, but it seems
> postgres dont understand them.
>
> Is there another way to do this in postgres ?
> if so, where i can read about it ?
>
> SELECT * from some_table WHERE MOD(some_row, :n) = 0;

So this allows you to get every Xth result, like every 3rd row.  Wow,
that is interesting.  We don't have a ROWNUM like Oracle has, but if we
did you could just use mod on that:

    ROWNUM % 3 = 0


You could use a cursor and fetch only every Xth row.  Not sure what else
I can suggest.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Shell Script help for backup
Следующее
От: "Alex Cheung Tin Ka"
Дата:
Сообщение: type conversion between text and timestamp