468,505 Members | 1,939 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

How to select odd and even numbers in mysql

To select even or odd IDs from a MySQL table, you would use the 'MOD', this easy way to select the Odd and Even numbers/.

Odd number select...

select column_name from table_name where mod(column_name,2)=1;
Even number select..

select column_name from table_name where mod(column_name,2)=0;
if u need odd or even number put 1 or 0.
Jun 14 '14 #1
2 34590
1,043 Expert 1GB
you posted this in 'Questions', should it not be in 'Articles'
Jun 14 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Caro | last post: by
6 posts views Thread by devoreband | last post: by
7 posts views Thread by Shinzon | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.