423,335 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,335 IT Pros & Developers. It's quick & easy.

How to select odd and even numbers in mysql

P: 1
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
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 921
you posted this in 'Questions', should it not be in 'Articles'
Jun 14 '14 #2

P: 30

Post your reply

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