M
M
Messi2018-05-22 18:50:50
MySQL
Messi, 2018-05-22 18:50:50

Why aren't records returned?

There is a table:
parent_id refers to id
fk-parent_id -> id
parent_id default NULL
id(int) name(string) parent_id(int)
1 name1 null
2 ​​name2 null
3 name3 1
When I make a query:
select * from table where parent_id = 1
One record is displayed - ok
select * from table where id <> 1
Two records are displayed - ok
select * from table where parent_id <> 1
Returned 0 records. Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Den Korolev, 2018-05-22
@FitTech

Because there are no matching entries. Or do you think null == 0 ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question