List:General Discussion« Previous MessageNext Message »
From:Christoph Boget Date:August 31 2010 6:06pm
Subject:Re: Even or Odds numbers
View as plain text  
> is there a function, using MySQL 5.0v, that can detect if a numerical value
> is either an Even or Odd number

MOD()

http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_mod

SELECT MOD( X, 2 )

where X is your number (or column name).  If 0, it's even if 1 it's odd.

thnx,
Christoph
Thread
Even or Odds numbersMike Blezien31 Aug
  • RE: Even or Odds numbersJay Blanchard31 Aug
  • Re: Even or Odds numbersChristoph Boget31 Aug
  • Re: Even or Odds numbersMike Blezien31 Aug
    • RE: Even or Odds numbersDaevid Vincent31 Aug