Re: ODD vs EVEN in select
Posted in 1997
Topics: SQL Development & Query Writing
Peter Procenko wrote:
>
> What is the easiest way to select only ODD or EVEN from a int field in a
> select statement, via SQL ?
For EVEN numbers:
SELECT *
FROM tables
WHERE int_col/2 = ROUND(int_col/2)
For ODD numbers:
SELECT *
FROM tables
WHERE int_col/2 != ROUND(int_col/2)
Hope that helps,
--
Mark.
+------------------------------------------------------------------+
|Mark D. Stock - The West Solutions Group http://www.west.co.za |
| The Informix FAQ is at http://www.iiug.org |
|mailto:marks@west.co.za +-----------------------------------------+
|Tel: +27 11 803 2151 |If it doesn't work, force it! |
|Fax: +27 11 803 2189 |If it breaks, it needed replacing anyway!|
|Cell: +27 83 250 2325 |Well, that's how I code anyway! |
+------------------------+-----------------------------------------+