473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 49822
Luuk
1,047 Expert 1GB
you posted this in 'Questions', should it not be in 'Articles'
Jun 14 '14 #2

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

Similar topics

1
by: Caro | last post by:
Hello, Is it possible to create a sort of validation rule that will limit the data entry in a field to even numbers only ? thaks, Caro
17
by: Ron | last post by:
I want to write a program that will accept a number in a textbox for example 23578 and then in a label will display the sum of the odd and even number like this... the textbox containsthe number...
4
by: ghostrider | last post by:
I ned help in figuring out to make my program display even numbers only. My for loop counts every number, but I only need to display the even ones. Can someone help me with this?
6
by: devoreband | last post by:
hey i wrote all my code but i need to print out only the even numbers so is there any predefined function i can use or what can structure i should be following? ........ 16 for(int r = 0;...
7
Shinzon
by: Shinzon | last post by:
Hey guys and girls, I am pretty well versed in perl, but am just learning Java and I was wondering if anyone could explain how I would ask for an input of only even numbers or maybe point me in...
2
by: s2c2 | last post by:
Hello. sorry for my poor english. i try to make a select from 2 mysql servers located in diferents machines. i call a mysql stored procedure from java app and i want join a select from table...
2
by: colordrm88 | last post by:
Here is what I am supposed to do...Write a C++ program that asks for 10 numbers and prints the sum of only the even numbers. I also have to use an if statement and a while loop. Please please...
1
by: jonkillua | last post by:
hi guys, i'm creating a program that instead of using the print method to display the odd/even numbers, i want to display the result in label.caption. Im crazy about it, please help me. Private...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.