Select the Even and Odd records

How to select the Even and Odd records in SQL server and in Oracle without using ROWNUM,ROWID

Showing Answers 1 - 3 of 3 Answers

ETL Dev

  • Jul 25th, 2015
 

If the values have any ID values the usign mod function we can provide the details
mod(id,2)=0 will be even and mod(id,2)=1 will be odd

  Was this answer useful?  Yes

MUKUL MALIK

  • Aug 22nd, 2016
 

SELECT customerid,case when customerID %2=0 then even
when customerID %2 < > 0 then odd end as result from customers

  Was this answer useful?  Yes

Sirisha d

  • Jan 30th, 2017
 

Code
  1. span style="font-style: italic;">-----------------------------------------------

  2. -----------------------------------------------

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions