FW: Even or Odds numbers
am 31.08.2010 20:10:14 von Michael.Coll-Barth
=20
> -----Original Message-----
> From: Christoph Boget [mailto:christoph.boget@gmail.com]=20
> http://dev.mysql.com/doc/refman/5.0/en/mathematical-function s.
html#function_mod
>=20
> SELECT MOD( X, 2 )
>=20
> where X is your number (or column name). If 0, it's even if=20
> 1 it's odd.
I think you mean, if it is non-zero, then it is odd.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: FW: Even or Odds numbers
am 31.08.2010 20:25:45 von Christoph Boget
>> where X is your number (or column name). =A0If 0, it's even if
>> 1 it's odd.
> I think you mean, if it is non-zero, then it is odd.
If you're MODding using 2 as the second argument, it's always going to
be 0 or 1. 2 either divides in to the number evenly, having a
remainder of 0, or it'll have a remainder of 1. The former indicates
the number is even, the latter odd.
thnx,
Christoph
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
RE: FW: Even or Odds numbers
am 31.08.2010 20:35:43 von Michael.Coll-Barth
My apologies. With your example; SELECT MOD( X, 2 ), it will do exactly =
as you say it will do.
-----Original Message-----
From: Christoph Boget [mailto:christoph.boget@gmail.com]=20
Sent: Tuesday, August 31, 2010 2:26 PM
To: Coll-Barth, Michael
Cc: mysql@lists.mysql.com
Subject: Re: FW: Even or Odds numbers
>> where X is your number (or column name). =A0If 0, it's even if
>> 1 it's odd.
> I think you mean, if it is non-zero, then it is odd.
If you're MODding using 2 as the second argument, it's always going to
be 0 or 1. 2 either divides in to the number evenly, having a
remainder of 0, or it'll have a remainder of 1. The former indicates
the number is even, the latter odd.
thnx,
Christoph
--=20
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: =
http://lists.mysql.com/mysql?unsub=3Dmichael.coll-barth@veri zonwireless.c=
om
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg