Answer the question
In order to leave comments, you need to log in
Why does an empty query return all rows?
How can I fix the query so that when the query is empty, rows with verified = 1 and deleted = null are returned? Now returns all rows. Even where verified = null and deleted = 1.
SELECT * FROM `injureds` WHERE `verified` = 1 AND `deleted` IS NULL AND `id` LIKE CONCAT('%%') OR `iname` LIKE CONCAT('%%');
Answer the question
In order to leave comments, you need to log in
Put brackets:
SELECT
*
FROM
`injureds`
WHERE
`verified` = 1 AND
`deleted` IS NULL AND (
`id` LIKE CONCAT('%%') OR
`iname` LIKE CONCAT('%%')
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question