Even or Odds numbers

Even or Odds numbers

am 31.08.2010 20:00:16 von mickalo

Hello,

is there a function, using MySQL 5.0v, that can detect if a numerical value is
either an Even or Odd number

Thanks,

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Custom Programming & Web Hosting Services
http://www.thunder-rain.com/
Office: 1.712.395.0670
Skype Contact: cgimickalo
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

RE: Even or Odds numbers

am 31.08.2010 20:03:41 von Jay Blanchard

[snip]
is there a function, using MySQL 5.0v, that can detect if a numerical
value is=20
either an Even or Odd number
[/snip]

You can use modulus
http://www.roseindia.net/sql/mysql-example/mysql-modulus.sht ml


--
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: Even or Odds numbers

am 31.08.2010 20:06:19 von Christoph Boget

> 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-function s.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

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Even or Odds numbers

am 31.08.2010 20:12:39 von mickalo

----- Original Message -----
From: "Christoph Boget"
To: "Mike Blezien"
Cc: "MySQL List"
Sent: Tuesday, August 31, 2010 1:06 PM
Subject: Re: Even or Odds numbers


>> 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-function s.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
>

Thanks that should do the trick. Appreciate the other response too. Big help :)

Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Custom Programming & Web Hosting Services
http://www.thunder-rain.com/
Office: 1.712.395.0670
Skype Contact: cgimickalo
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

RE: Even or Odds numbers

am 31.08.2010 20:24:22 von Daevid Vincent

Not sure what you're trying to do, but if all you want to do is toggle
between two things (as in row color zebra stripes or something) then I
would suggest you not use some MOD() routine and instead just flip a
boolean.

For example in PHP just do:



just sayin'.

> -----Original Message-----
> From: Mike Blezien [mailto:mickalo@frontiernet.net]
> Sent: Tuesday, August 31, 2010 11:13 AM
> To: jcboget@yahoo.com
> Cc: MySQL List
> Subject: Re: Even or Odds numbers
>
> ----- Original Message -----
> From: "Christoph Boget"
> To: "Mike Blezien"
> Cc: "MySQL List"
> Sent: Tuesday, August 31, 2010 1:06 PM
> Subject: Re: Even or Odds numbers
>
>
> >> 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-function s.
> 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
> >
>
> Thanks that should do the trick. Appreciate the other
> response too. Big help :)
>
> Mike(mickalo)Blezien
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Thunder Rain Internet Publishing
> Custom Programming & Web Hosting Services
> http://www.thunder-rain.com/
> Office: 1.712.395.0670
> Skype Contact: cgimickalo
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=daevid@daevid.com
>


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org