Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: alternative rows
For even numbered rows .....
select col_1, col_2
from (select col_1, col_2, rownum rnum
from my_table)
where mod(rnum, 2) = 0
For odd numbered rows ...
select col_1, col_2
from (select col_1, col_2, rownum rnum
from my_table)
where mod(rnum, 2) <> 0
A from clause select is useful because you can perform your ORDER BY etc in the from clause query and then use the rownum.
HTH
Raj
QOTD: Any clod can have facts, but having an opinion is an art !
*********************************************************************2
This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.
*********************************************************************2
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Jamadagni, Rajendra
INET: Rajendra.Jamadagni_at_espn.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Aug 29 2001 - 11:17:09 CDT