Reputation: 15
I have a table in database with the name module
, and I want the SELECT
statement to show all values that has delete_time
with either NULL
or 0000-00-00 00:00:00
. I used the following statement, but it did not work.
The statement is:
$statment="SELECT * FROM module where delete_time IS NULL OR delete_time IS '0000-00-00 00:00:00 '";
Upvotes: 1
Views: 29
Reputation: 41508
Two things:
'0000-00-00 00:00:00 '
IS
to compare delete_time
to '0000-00-00 00:00:00'
. IS
is to compare against boolean values or NULL
. Use =
instead.Try this:
$statment="SELECT * FROM module where delete_time IS NULL OR delete_time = '0000-00-00 00:00:00'";
Upvotes: 1