even positioned rows [message #257347] |
Wed, 08 August 2007 02:36 |
tarunj
Messages: 23 Registered: April 2007 Location: Noida
|
Junior Member |
|
|
I have a table "mycd" which has one column name.
name
---------
David
Jimmy
Sam
Jethro
William
Now I want all the even positioned rows.
I tried:--
select name,mod(rownum,2) as rnum from mycd where rnum=0;
It throws the following error:-
ORA-00904: "rnum": invalid identifier
|
|
|
|
|
Re: even positioned rows [message #257353 is a reply to message #257352] |
Wed, 08 August 2007 02:49 |
tarunj
Messages: 23 Registered: April 2007 Location: Noida
|
Junior Member |
|
|
select name,mod(rownum,2) as rnum from mycd where mod(rownum,2)=0;
gives no result.
Why i can't use rnum in where clause?
is there any other way?
|
|
|
|
|
|
|
|
|
Re: even positioned rows [message #257445 is a reply to message #257429] |
Wed, 08 August 2007 06:52 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
A short reminder: if you talk about even and odd rows, you talk about order. You want your result set ordered. It is up to you, tarunj, to tell Oracle how you want your rows sorted. Can you tell us how you want to sort the result set? Once we cleared that, we can talk about even and odd.
MHE
|
|
|