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: SoulSurvivor <markyg_7_at_yahoo.co.uk>
Date: 3 Feb 2003 07:21:14 -0800
Message-ID: <8d9c6fd.0302030721.336c9577@posting.google.com>


Hiya,

You are on the right track, but nt quite there.

You didnt give your Oracle version. I'm assuming that you can run "inline views".

Try the following:

SELECT a.rn, a.testtime
FROM
   (SELECT rownum rn , testtime, mod(rownum, 2) mood     FROM testdata) a
WHERE a.mood = 0;

M

"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:21:14 CST

Original text of this message

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