MySQL: View Odd or Even Numbered Records
Posted on Jul 25, 2008 under Software Tips |I was playing in a MySQL database and wanted to only view the records that had odd numbers in the ID field. I was able to accomplish this by selecting SQL and using the following code:
SELECT * FROM ‘tablename’ WHERE id%2=1
You can also display even numbered records with:
SELECT * FROM ‘tablename’ WHERE id%2=0
Replace tablename with the name of the table you are using.

Leave a comment