SELECT id, company_id, user_id, valid_until, price
FROM `classifieds`
WHERE `user_id` = 1
AND `valid_until` > now()
AND `price` = -2
this query gives me one row, and it works ok…
as soon as i add a statement
SELECT id, company_id, user_id, valid_until, price
FROM `classifieds`
WHERE `user_id` = 1
AND `valid_until` > now()
AND `price` = -2
AND `company_id` != 23
it gives me nothing!!!
the row I am getting in first query has company_id NULL
id company_id user_id valid_until price
35136 NULL 1 2012-02-12 08:06:37 -2
Please advise
EDIT:
I don’t want rows that have company_id NULL. I want ALL rows (NULL and not NULL) except for (company_id) value 23.
this seems to do the trick