I have a MySQL query left joining two tables. This is the current query result:
id | login | privacy-weight | requires
--------------------------------------------
0 | user | 1 | NULL
0 | user2 | 1 | NULL
0 | user3 | 1 | privacy-weight
The query itself is not important, as I'd only like to add a WHERE condition to the query as it is now.
I need to fetch only values which (in my own words):
IF (`requires` = 'privacy-weight'), then `privacy-weight` must equal = 0;
That means, I need this condition:
WHERE `privacy-weight` = 0
BUT only if this is true:
requires = 'privacy-weight'
Can this be done?
EDIT
Obviously this is too difficult to understand, therefore, an example output:
privacy-weight | requires
-------------------------
0 | NULL
1 | NULL
0 | privacy-weight
1 | NULL
These would be ignored (not fetched):
privacy-weight | requires
-------------------------
1 | privacy-weight
requires <> 'privacy-weight'what do you expect?privacy-weightcolumn then as it's basically based onrequirescolumn ?