I wrote this query to display the "estado" rows if they don't have the values "entregado" or "cancelado" everything works fine The problem is that if a status row "estado" has the NULL value, it is not displayed, why?
How would I make it show up?
Since my goal is only to hide the rows that have the values "entregado" or "cancelado"
This is my query in phpMyAdmin
SELECT * FROM `wp_AAAedubot` WHERE `celular` AND celular NOT LIKE 'Robot-%' AND estado NOT LIKE 'entregado' AND estado NOT LIKE 'cancelado' ORDER BY `wp_AAAedubot`.`time` DESC
CodePudding user response:
There's nothing in your SQL which would prevent a row from being retrieved if estado
is null. However, you are checking the celular
column too, which is probably causing your issue.
To only hide the rows that have the values "entregado" or "cancelado", do this:
SELECT
*
FROM
`wp_AAAedubot`
WHERE
estado NOT LIKE 'entregado' AND
estado NOT LIKE 'cancelado';
CodePudding user response:
I fixed it this way I wonder if it will be ok It does its job but I don't know if I put it together correctly for better performance.
SELECT * FROM `wp_AAAedubot` WHERE `celular` AND
celular NOT LIKE 'Robot-%'AND
estado NOT LIKE 'entregado' AND
estado NOT LIKE 'cancelado' OR
estado IS NULL ORDER BY `wp_AAAedubot`.`time` DESC