From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Ben-Nes Michael <miki(at)canaan(dot)co(dot)il> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is this query possible in PostgreSQL ? |
Date: | 2002-07-29 03:25:50 |
Message-ID: | 200207290325.g6T3PoR27735@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Kings-Lynne | 2002-07-29 03:51:25 | Re: [GENERAL] Stats Collector |
Previous Message | Bruce Momjian | 2002-07-29 03:22:22 | Re: Shell Script help for backup |