Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL WHERE id is odd?

Tags:

sql

php

I was wondering if it were possible to list all of the ODD ID' using PHP and SQL.

I am currently using, which shows all results:

$result = $con->query("SELECT * FROM Users");

How would it be possible to list only ODD results using PHP and SQL?

thanks in advance..

like image 208
user3580557 Avatar asked Jun 27 '26 06:06

user3580557


1 Answers

Or you can do probably faster solution:

$result = $con->query("SELECT * FROM Users WHERE id % 2");

DEMO

like image 54
Lkopo Avatar answered Jun 29 '26 20:06

Lkopo