Query not working [message #297210] |
Wed, 30 January 2008 12:07  |
renjithtkm
Messages: 5 Registered: January 2008 Location: TVM
|
Junior Member |
|
|
Why is this query not working. I intend to get the alternate rows.
select * from <table> where mod(rownum,2)=0
why is above query not working as i expected to be?.
I am able to get alternate rows by the following query
select * from <table> where (rowid,0) in (select rowid,mod(rownum,2)from <table>).
Please explain why the first query is not working?.
|
|
|
|
|
Re: Query not working [message #297235 is a reply to message #297212] |
Wed, 30 January 2008 14:35   |
renjithtkm
Messages: 5 Registered: January 2008 Location: TVM
|
Junior Member |
|
|
Thanks Rajaram..But i am still having the doubt...Why is the query select * from <table> where mod(rownum,2) = 0 wont return the alternate rows?..
|
|
|
Re: Query not working [message #297237 is a reply to message #297235] |
Wed, 30 January 2008 14:58   |
S.Rajaram
Messages: 1027 Registered: October 2006 Location: United Kingdom
|
Senior Member |
|
|
SQL> select rownum, table_name from cat;
SQL> select rownum, table_name from cat where rownum < 3;
SQL> select rownum, table_name from cat where rownum > 1;
Execute the above query and figure it out yourself why your query is not working. If you still cannot understand read the manual again and again, you will definitely understand why your query is not working.
Happy learning
Regards
Raj
|
|
|
|
|