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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Selecting every other code.... why wont THIS work?

Re: Selecting every other code.... why wont THIS work?

From: Frans H. <fransh_at_hotmail.com>
Date: 3 Feb 2003 07:45:55 -0800
Message-ID: <31abf0e5.0302030745.35d78201@posting.google.com>


Yes, you do.
As soon as add a where-clause the rownums will change...

Try this:
select testtime
, my_rownum
from
( SELECT testtime
  , MOD(rownum,2) my_rownum
   FROM testdata)
where my_rownum = 1

should work,

hth
Frans H.

"elziko" <elziko_at_NOTSPAMMINGyahoo.co.uk> wrote in message news:<3e3e43f6$0$12354$afc38c87_at_news.easynet.co.uk>...
> If I do the following:
>
> SELECT testtime, MOD(rownum,2) FROM testdata
>
> I get the following output:
>
> 0.0 1
> 0.1 0
> 0.2 1
> 0.3 0
> 0.4 1
>
> and so on. So by my reckoning, in order to select only every OTHER row in
> this table I should be able to do:
>
> SELECT testtime FROM testdata WHERE MOD(rownum,2) = 1
>
> But it returns no records! I've obviously missed something here?!?
>
> Cheers,
>
> elziko
Received on Mon Feb 03 2003 - 09:45:55 CST

Original text of this message

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