Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Selecting every other code.... why wont THIS work?
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
![]() |
![]() |