Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Filtered Query on nth row

Re: Filtered Query on nth row

From: Martin Haltmayer <Martin_Haltmayer_at_KirchGruppe.de>
Date: 1998/02/10
Message-ID: <34DFF55F.EDEBA881@KirchGruppe.de>#1/1

You mentioned the first, sixth, etc. row. According to which order? All the solutions I saw do not respect an order within your rows. Remember that you may receive the result rows in arbitrary order.

Therefore, to ensure a certain order you have to use something with "order by". You could try the combination of "mod (rownum, 5) = 0" and "order by". Furthermore, you will get no single row because the rownum mechanism is working on a step-by-step philosophy. The condition "mod (rownum, 5) = 0" is false for the first row, so rownum (that is the number of retrieved rows by definition) remains 0 and so on. The condition will never be met, you will not get any row.

Martin Haltmayer

Jeff Jackson wrote:
>
> Does anyone know how to do a query and filter every nth row ? Example,
> I have 100 rows returned but I am only intereseted in every other fith
> row for example.... row1, row6, row11,row16 etc.... I don't want to see
> rows 2,3,4,5,7,8,9,10 etc ... Is this possible ?
>
> Does SQL allow me to do this ? I have tried all kinds of queries,
> correlated, inner joins, sub queries and various expressions.
Received on Tue Feb 10 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US